From 86d5eee4b42c18de851e7e73a0bc47b1c50c6538 Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Fri, 9 Jan 2026 15:27:25 +0100 Subject: [PATCH 01/16] introduce parent pom and reactor pom and move main module to "impl" folder --- .gitignore | 2 +- bnd.bnd => impl/bnd.bnd | 0 impl/pom.xml | 271 ++++++++++++++++++ .../models/impl/AdapterImplementations.java | 0 .../impl/DisposalCallbackRegistryImpl.java | 0 .../sling/models/impl/ExportServlet.java | 0 .../impl/FirstImplementationPicker.java | 0 .../impl/MapBackedInvocationHandler.java | 0 .../models/impl/ModelAdapterFactory.java | 0 .../ModelAdapterFactoryConfiguration.java | 0 .../impl/ModelConfigurationPrinter.java | 0 .../impl/ModelPackageBundleListener.java | 0 .../sling/models/impl/ReflectionUtil.java | 0 ...sourceOverridingJakartaRequestWrapper.java | 0 .../ResourceOverridingRequestWrapper.java | 0 .../impl/ResourceTypeBasedResourcePicker.java | 0 .../org/apache/sling/models/impl/Result.java | 0 .../impl/SlingModelsScriptEngineFactory.java | 0 .../models/impl/ThreadInvocationCounter.java | 0 .../impl/injectors/AbstractInjector.java | 0 .../impl/injectors/BindingsInjector.java | 0 .../impl/injectors/ChildResourceInjector.java | 0 .../impl/injectors/OSGiServiceInjector.java | 0 .../injectors/RequestAttributeInjector.java | 0 .../impl/injectors/ResourcePathInjector.java | 0 .../models/impl/injectors/SelfInjector.java | 0 .../impl/injectors/SlingObjectInjector.java | 0 .../impl/injectors/ValueMapInjector.java | 0 .../impl/model/AbstractInjectableElement.java | 0 .../impl/model/ConstructorParameter.java | 0 .../models/impl/model/InjectableElement.java | 0 .../models/impl/model/InjectableField.java | 0 .../models/impl/model/InjectableMethod.java | 0 .../sling/models/impl/model/ModelClass.java | 0 .../impl/model/ModelClassConstructor.java | 0 .../model/OptionalTypedInjectableElement.java | 0 .../model/ParameterCountInjectComparator.java | 0 .../via/AbstractResourceTypeViaProvider.java | 0 .../impl/via/BeanPropertyViaProvider.java | 0 .../impl/via/ChildResourceViaProvider.java | 0 .../via/ForcedResourceTypeViaProvider.java | 0 .../via/OriginalResourceTypeViaProvider.java | 0 .../via/ResourceSuperTypeViaProvider.java | 0 ...ourceTypeForcingJakartaRequestWrapper.java | 0 .../ResourceTypeForcingRequestWrapper.java | 0 .../ResourceTypeForcingResourceWrapper.java | 0 .../sling/models/impl/AdapterFactoryTest.java | 0 .../impl/AdapterImplementationsTest.java | 0 .../models/impl/AnnotationConflictsTest.java | 0 .../apache/sling/models/impl/CachingTest.java | 0 .../sling/models/impl/ConstructorTest.java | 0 .../impl/ConstructorVisibilityTest.java | 0 .../sling/models/impl/CustomInjectorTest.java | 0 .../impl/DefaultInterfaceMethodTest.java | 0 .../apache/sling/models/impl/DefaultTest.java | 0 .../sling/models/impl/ExtraDefaultTests.java | 0 .../models/impl/ImplementsExtendsTest.java | 0 .../impl/InjectorSpecificAnnotationTest.java | 0 .../models/impl/InterfaceInheritanceTest.java | 0 .../models/impl/InvalidAdaptationsTest.java | 0 .../models/impl/ModelAdapterFactoryTest.java | 0 ...Factory_ImplementationPickerOrderTest.java | 0 ...ModelAdapterFactory_InjectorOrderTest.java | 0 .../impl/ModelPackageBundleListenerTest.java | 0 .../models/impl/MultipleInjectorTest.java | 0 .../sling/models/impl/OSGiInjectionTest.java | 0 .../models/impl/OptionalObjectsTest.java | 0 .../models/impl/OptionalPrimitivesTest.java | 0 ...meterizedTypeFromRequestAttributeTest.java | 0 .../sling/models/impl/PostConstructTest.java | 0 .../sling/models/impl/ReflectionUtilTest.java | 0 .../models/impl/RequestDisposalTest.java | 0 .../models/impl/RequestInjectionTest.java | 0 .../sling/models/impl/RequestWrapperTest.java | 0 .../models/impl/ResourceModelClassesTest.java | 0 .../impl/ResourceModelConstructorTest.java | 0 .../impl/ResourceModelInterfacesTest.java | 0 ...ceOverridingJakartaRequestWrapperTest.java | 0 .../ResourceOverridingRequestWrapperTest.java | 0 .../impl/ResourcePathInjectionTest.java | 0 .../sling/models/impl/SelfDependencyTest.java | 0 .../models/impl/ServicePropertiesMap.java | 0 .../impl/StaticInjectionAPFLoadOrderTest.java | 0 .../org/apache/sling/models/impl/ViaTest.java | 0 .../FirstImplementationPickerTest.java | 0 .../impl/injector/CustomAnnotation.java | 0 .../injector/CustomAnnotationInjector.java | 0 .../models/impl/injector/SimpleInjector.java | 0 .../impl/injectors/BindingsInjectorTest.java | 0 .../RequestAttributeInjectorTest.java | 0 .../injectors/ResourcePathInjectorTest.java | 0 .../ResourceResolverInjectorTest.java | 0 .../impl/injectors/SelfInjectorTest.java | 0 .../SlingObjectInjectorRequestTest.java | 0 ...ingObjectInjectorResourceResolverTest.java | 0 .../SlingObjectInjectorResourceTest.java | 0 .../impl/injectors/ValueMapInjectorTest.java | 0 .../AbstractResourceTypeViaProviderTest.java | 0 .../impl/via/BeanPropertyViaProviderTest.java | 0 .../via/ChildResourceViaProviderTest.java | 0 .../ForcedResourceTypeViaProviderTest.java | 0 .../OriginalResourceTypeViaProviderTest.java | 0 .../via/ResourceSuperTypeViaProviderTest.java | 0 ...eTypeForcingJakartaRequestWrapperTest.java | 0 ...ResourceTypeForcingRequestWrapperTest.java | 0 .../testmodels/classes/ArrayOSGiModel.java | 0 .../classes/ArrayPrimitivesModel.java | 0 .../classes/ArrayWrappersModel.java | 0 .../testmodels/classes/BindingsModel.java | 0 .../testmodels/classes/CachedModel.java | 0 .../CachedModelWithAdapterTypes12.java | 0 .../CachedModelWithAdapterTypes23.java | 0 .../classes/CachedModelWithSelfReference.java | 0 .../models/testmodels/classes/ChildModel.java | 0 .../classes/ChildResourceModel.java | 0 .../classes/ChildResourceViaModel.java | 0 .../classes/ChildValueMapModel.java | 0 .../classes/CollectionDefaultsModel.java | 0 .../classes/CollectionOSGiModel.java | 0 .../ConstructorWithExceptionModel.java | 0 .../classes/DefaultPrimitivesModel.java | 0 .../classes/DefaultStringModel.java | 0 .../classes/DefaultWrappersModel.java | 0 .../DirectCyclicSelfDependencyModel.java | 0 .../classes/FailingPostConstructModel.java | 0 .../classes/FalsePostConstructModel.java | 0 .../IndirectCyclicSelfDependencyModelA.java | 0 .../IndirectCyclicSelfDependencyModelB.java | 0 .../InjectorSpecificAnnotationModel.java | 0 .../classes/InvalidConstructorModel.java | 0 .../InvalidModelWithMissingAnnotation.java | 0 .../testmodels/classes/ListDefaultsModel.java | 0 .../models/testmodels/classes/ListModel.java | 0 .../testmodels/classes/ListOSGiModel.java | 0 .../classes/OptionalArrayOSGiModel.java | 0 .../classes/OptionalListOSGiModel.java | 0 .../classes/OptionalObjectsModel.java | 0 .../classes/OptionalPrimitivesModel.java | 0 .../testmodels/classes/ParentModel.java | 0 .../testmodels/classes/RequestOSGiModel.java | 0 .../ResourceModelWithRequiredField.java | 0 ...odelWithRequiredFieldOptionalStrategy.java | 0 .../classes/ResourcePathAllOptionalModel.java | 0 .../testmodels/classes/ResourcePathModel.java | 0 .../classes/ResourcePathModelWrapping.java | 0 .../classes/ResourcePathPartialModel.java | 0 .../classes/SelfDependencyModelA.java | 0 .../classes/SelfDependencyModelB.java | 0 .../testmodels/classes/SetOSGiModel.java | 0 ...impleModelWithInvalidSecondAnnotation.java | 0 .../testmodels/classes/SimpleOSGiModel.java | 0 .../classes/SimplePropertyModel.java | 0 .../models/testmodels/classes/SubClass.java | 0 .../SubClassOverriddenPostConstruct.java | 0 .../models/testmodels/classes/SuperClass.java | 0 .../classes/SuperclassConstructorModel.java | 0 .../classes/TruePostConstructModel.java | 0 .../testmodels/classes/UncachedModel.java | 0 .../models/testmodels/classes/ViaModel.java | 0 .../classes/WithOneConstructorModel.java | 0 .../classes/WithThreeConstructorsModel.java | 0 .../classes/WithTwoConstructorsModel.java | 0 .../classes/annotations/Hidden.java | 0 .../classes/annotations/OtherAnnotation.java | 0 .../constructorinjection/BindingsModel.java | 0 .../DefaultPrimitivesModel.java | 0 .../DefaultStringModel.java | 0 .../DefaultWrappersModel.java | 0 .../InjectorSpecificAnnotationModel.java | 0 .../constructorinjection/ListOSGiModel.java | 0 .../constructorinjection/NoNameModel.java | 0 .../OptionalPrimitivesModel.java | 0 .../constructorinjection/ParentModel.java | 0 .../constructorinjection/SimpleOSGiModel.java | 0 .../ViaRequestSuffixModel.java | 0 .../WithThreeConstructorsOneInjectModel.java | 0 .../PackagePrivateConstructorModel.java | 0 .../PrivateConstructorModel.java | 0 .../ProtectedConstructorModel.java | 0 .../implextend/EvenSimplerPropertyModel.java | 0 .../implextend/ExtendsClassPropertyModel.java | 0 .../ImplementsInterfacePropertyModel.java | 0 .../ImplementsInterfacePropertyModel2.java | 0 ...validImplementsInterfacePropertyModel.java | 0 .../InvalidSampleServiceInterface.java | 0 .../implextend/SampleServiceInterface.java | 0 .../implextend/SimplePropertyModel.java | 0 .../testmodels/interfaces/AdapterType1.java | 0 .../testmodels/interfaces/AdapterType2.java | 0 .../testmodels/interfaces/AdapterType3.java | 0 .../testmodels/interfaces/CachedModel.java | 0 .../testmodels/interfaces/ChildModel.java | 0 .../interfaces/ChildResourceModel.java | 0 .../interfaces/ChildValueMapModel.java | 0 .../interfaces/ModelWithDefaultMethods.java | 0 .../interfaces/OptionalPrimitivesModel.java | 0 .../testmodels/interfaces/ParentModel.java | 0 .../interfaces/PropertyModelWithDefaults.java | 0 .../ResourceModelWithRequiredField.java | 0 .../interfaces/ServiceInterface.java | 0 .../interfaces/SimplePropertyModel.java | 0 .../testmodels/interfaces/SubClassModel.java | 0 .../interfaces/SuperClassModel.java | 0 .../testmodels/interfaces/UncachedModel.java | 0 .../testutil/ModelAdapterFactoryUtil.java | 0 parent/pom.xml | 55 ++++ pom.xml | 253 +--------------- 207 files changed, 339 insertions(+), 242 deletions(-) rename bnd.bnd => impl/bnd.bnd (100%) create mode 100644 impl/pom.xml rename {src => impl/src}/main/java/org/apache/sling/models/impl/AdapterImplementations.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/DisposalCallbackRegistryImpl.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/ExportServlet.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/FirstImplementationPicker.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/MapBackedInvocationHandler.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/ModelAdapterFactoryConfiguration.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/ModelConfigurationPrinter.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/ModelPackageBundleListener.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/ReflectionUtil.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/ResourceOverridingJakartaRequestWrapper.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/ResourceOverridingRequestWrapper.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/ResourceTypeBasedResourcePicker.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/Result.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/SlingModelsScriptEngineFactory.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/ThreadInvocationCounter.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/injectors/AbstractInjector.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/injectors/BindingsInjector.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/injectors/ChildResourceInjector.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/injectors/OSGiServiceInjector.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/injectors/RequestAttributeInjector.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/injectors/ResourcePathInjector.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/injectors/SelfInjector.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/injectors/SlingObjectInjector.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/injectors/ValueMapInjector.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/model/AbstractInjectableElement.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/model/ConstructorParameter.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/model/InjectableElement.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/model/InjectableField.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/model/InjectableMethod.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/model/ModelClass.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/model/ModelClassConstructor.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/model/OptionalTypedInjectableElement.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/model/ParameterCountInjectComparator.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/via/AbstractResourceTypeViaProvider.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/via/BeanPropertyViaProvider.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/via/ChildResourceViaProvider.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/via/ForcedResourceTypeViaProvider.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/via/OriginalResourceTypeViaProvider.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/via/ResourceSuperTypeViaProvider.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/via/ResourceTypeForcingJakartaRequestWrapper.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/via/ResourceTypeForcingRequestWrapper.java (100%) rename {src => impl/src}/main/java/org/apache/sling/models/impl/via/ResourceTypeForcingResourceWrapper.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/AdapterFactoryTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/AdapterImplementationsTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/AnnotationConflictsTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/CachingTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/ConstructorTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/ConstructorVisibilityTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/CustomInjectorTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/DefaultInterfaceMethodTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/DefaultTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/ExtraDefaultTests.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/ImplementsExtendsTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/InjectorSpecificAnnotationTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/InterfaceInheritanceTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/InvalidAdaptationsTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/ModelAdapterFactoryTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/ModelAdapterFactory_ImplementationPickerOrderTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/ModelAdapterFactory_InjectorOrderTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/ModelPackageBundleListenerTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/MultipleInjectorTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/OSGiInjectionTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/OptionalObjectsTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/OptionalPrimitivesTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/ParameterizedTypeFromRequestAttributeTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/PostConstructTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/ReflectionUtilTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/RequestDisposalTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/RequestInjectionTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/RequestWrapperTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/ResourceModelClassesTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/ResourceModelConstructorTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/ResourceModelInterfacesTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/ResourceOverridingJakartaRequestWrapperTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/ResourceOverridingRequestWrapperTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/ResourcePathInjectionTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/SelfDependencyTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/ServicePropertiesMap.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/StaticInjectionAPFLoadOrderTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/ViaTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/implpicker/FirstImplementationPickerTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/injector/CustomAnnotation.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/injector/CustomAnnotationInjector.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/injector/SimpleInjector.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/injectors/BindingsInjectorTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/injectors/RequestAttributeInjectorTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/injectors/ResourcePathInjectorTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/injectors/ResourceResolverInjectorTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/injectors/SelfInjectorTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/injectors/SlingObjectInjectorRequestTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/injectors/SlingObjectInjectorResourceResolverTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/injectors/SlingObjectInjectorResourceTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/injectors/ValueMapInjectorTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/via/AbstractResourceTypeViaProviderTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/via/BeanPropertyViaProviderTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/via/ChildResourceViaProviderTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/via/ForcedResourceTypeViaProviderTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/via/OriginalResourceTypeViaProviderTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/via/ResourceSuperTypeViaProviderTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/via/ResourceTypeForcingJakartaRequestWrapperTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/impl/via/ResourceTypeForcingRequestWrapperTest.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/ArrayOSGiModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/ArrayPrimitivesModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/ArrayWrappersModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/BindingsModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/CachedModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/CachedModelWithAdapterTypes12.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/CachedModelWithAdapterTypes23.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/CachedModelWithSelfReference.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/ChildModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/ChildResourceModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/ChildResourceViaModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/ChildValueMapModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/CollectionDefaultsModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/CollectionOSGiModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/ConstructorWithExceptionModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/DefaultPrimitivesModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/DefaultStringModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/DefaultWrappersModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/DirectCyclicSelfDependencyModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/FailingPostConstructModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/FalsePostConstructModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/IndirectCyclicSelfDependencyModelA.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/IndirectCyclicSelfDependencyModelB.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/InjectorSpecificAnnotationModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/InvalidConstructorModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/InvalidModelWithMissingAnnotation.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/ListDefaultsModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/ListModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/ListOSGiModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/OptionalArrayOSGiModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/OptionalListOSGiModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/OptionalObjectsModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/OptionalPrimitivesModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/ParentModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/RequestOSGiModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/ResourceModelWithRequiredField.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/ResourceModelWithRequiredFieldOptionalStrategy.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/ResourcePathAllOptionalModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/ResourcePathModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/ResourcePathModelWrapping.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/ResourcePathPartialModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/SelfDependencyModelA.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/SelfDependencyModelB.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/SetOSGiModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/SimpleModelWithInvalidSecondAnnotation.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/SimpleOSGiModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/SimplePropertyModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/SubClass.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/SubClassOverriddenPostConstruct.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/SuperClass.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/SuperclassConstructorModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/TruePostConstructModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/UncachedModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/ViaModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/WithOneConstructorModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/WithThreeConstructorsModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/WithTwoConstructorsModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/annotations/Hidden.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/annotations/OtherAnnotation.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/BindingsModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/DefaultPrimitivesModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/DefaultStringModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/DefaultWrappersModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/InjectorSpecificAnnotationModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/ListOSGiModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/NoNameModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/OptionalPrimitivesModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/ParentModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/SimpleOSGiModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/ViaRequestSuffixModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/WithThreeConstructorsOneInjectModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/constructorvisibility/PackagePrivateConstructorModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/constructorvisibility/PrivateConstructorModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/constructorvisibility/ProtectedConstructorModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/implextend/EvenSimplerPropertyModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/implextend/ExtendsClassPropertyModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/implextend/ImplementsInterfacePropertyModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/implextend/ImplementsInterfacePropertyModel2.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/implextend/InvalidImplementsInterfacePropertyModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/implextend/InvalidSampleServiceInterface.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/implextend/SampleServiceInterface.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/classes/implextend/SimplePropertyModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/interfaces/AdapterType1.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/interfaces/AdapterType2.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/interfaces/AdapterType3.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/interfaces/CachedModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/interfaces/ChildModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/interfaces/ChildResourceModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/interfaces/ChildValueMapModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/interfaces/ModelWithDefaultMethods.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/interfaces/OptionalPrimitivesModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/interfaces/ParentModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/interfaces/PropertyModelWithDefaults.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/interfaces/ResourceModelWithRequiredField.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/interfaces/ServiceInterface.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/interfaces/SimplePropertyModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/interfaces/SubClassModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/interfaces/SuperClassModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testmodels/interfaces/UncachedModel.java (100%) rename {src => impl/src}/test/java/org/apache/sling/models/testutil/ModelAdapterFactoryUtil.java (100%) create mode 100644 parent/pom.xml diff --git a/.gitignore b/.gitignore index 0a3f3d11..ea97cd3d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -/target +target/ .vscode .idea .classpath diff --git a/bnd.bnd b/impl/bnd.bnd similarity index 100% rename from bnd.bnd rename to impl/bnd.bnd diff --git a/impl/pom.xml b/impl/pom.xml new file mode 100644 index 00000000..951d7d3f --- /dev/null +++ b/impl/pom.xml @@ -0,0 +1,271 @@ + + + + 4.0.0 + + + org.apache.sling + sling-bundle-parent + 62 + + + + org.apache.sling.models.impl + 2.0.1-SNAPSHOT + Apache Sling Models Implementation + Apache Sling Models Implementation + + + scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-impl.git + scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-impl.git + org.apache.sling.models.impl-1.7.2 + https://github.com/apache/sling-org-apache-sling-models-impl.git + + + + 2025-08-27T03:14:05Z + 17 + + + + + org.apache.sling + org.apache.sling.models.api + 2.0.0 + provided + + + org.osgi + org.osgi.framework + provided + + + org.osgi + org.osgi.service.component + provided + + + org.osgi + org.osgi.util.tracker + provided + + + org.osgi + org.osgi.service.http.whiteboard + provided + + + + org.osgi + org.osgi.service.component.annotations + provided + + + org.osgi + org.osgi.service.metatype.annotations + provided + + + org.osgi + org.osgi.annotation.versioning + provided + + + + javax.servlet + javax.servlet-api + 4.0.1 + provided + + + jakarta.servlet + jakarta.servlet-api + 6.0.0 + provided + + + org.apache.felix + org.apache.felix.http.wrappers + 1.1.10 + provided + + + org.apache.commons + commons-lang3 + 3.18.0 + provided + + + org.apache.sling + org.apache.sling.api + 3.0.0 + provided + + + org.apache.sling + org.apache.sling.scripting.api + 2.2.0 + provided + + + org.slf4j + slf4j-api + provided + + + javax.inject + javax.inject + provided + + + org.osgi + org.osgi.util.converter + provided + + + + org.apache.sling + org.apache.sling.scripting.core + 3.0.0 + compile + + + org.apache.felix + org.apache.felix.utils + + + + + org.jetbrains + annotations + provided + + + + junit + junit + test + + + org.apache.sling + org.apache.sling.testing.osgi-mock.junit4 + 3.5.2 + test + + + org.mockito + mockito-core + 4.4.0 + test + + + org.hamcrest + hamcrest-junit + 2.0.0.0 + test + + + org.slf4j + slf4j-simple + test + + + org.apache.sling + org.apache.sling.servlet-helpers + 2.0.0 + test + + + + org.apache.commons + commons-collections4 + 4.1 + test + + + + org.springframework + spring-context + 5.3.39 + test + + + javax.annotation + javax.annotation-api + 1.3.2 + provided + + + + + + org.apache.maven.plugins + maven-shade-plugin + + + + shade + + package + + true + true + + + org.apache.sling:org.apache.sling.scripting.core + + + + + org.apache.sling.scripting.core.impl.helper + slingmodelsimpl.org.apache.sling.scripting.core.impl.helper + + + + + org.apache.sling:org.apache.sling.scripting.core + + org/apache/sling/scripting/core/impl/helper/ProtectedBindings* + + + + + + + + + org.apache.rat + apache-rat-plugin + + + dependency-reduced-pom.xml + + + + + org.apache.maven.plugins + maven-source-plugin + + false + + + + + diff --git a/src/main/java/org/apache/sling/models/impl/AdapterImplementations.java b/impl/src/main/java/org/apache/sling/models/impl/AdapterImplementations.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/AdapterImplementations.java rename to impl/src/main/java/org/apache/sling/models/impl/AdapterImplementations.java diff --git a/src/main/java/org/apache/sling/models/impl/DisposalCallbackRegistryImpl.java b/impl/src/main/java/org/apache/sling/models/impl/DisposalCallbackRegistryImpl.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/DisposalCallbackRegistryImpl.java rename to impl/src/main/java/org/apache/sling/models/impl/DisposalCallbackRegistryImpl.java diff --git a/src/main/java/org/apache/sling/models/impl/ExportServlet.java b/impl/src/main/java/org/apache/sling/models/impl/ExportServlet.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/ExportServlet.java rename to impl/src/main/java/org/apache/sling/models/impl/ExportServlet.java diff --git a/src/main/java/org/apache/sling/models/impl/FirstImplementationPicker.java b/impl/src/main/java/org/apache/sling/models/impl/FirstImplementationPicker.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/FirstImplementationPicker.java rename to impl/src/main/java/org/apache/sling/models/impl/FirstImplementationPicker.java diff --git a/src/main/java/org/apache/sling/models/impl/MapBackedInvocationHandler.java b/impl/src/main/java/org/apache/sling/models/impl/MapBackedInvocationHandler.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/MapBackedInvocationHandler.java rename to impl/src/main/java/org/apache/sling/models/impl/MapBackedInvocationHandler.java diff --git a/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java b/impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java rename to impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java diff --git a/src/main/java/org/apache/sling/models/impl/ModelAdapterFactoryConfiguration.java b/impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactoryConfiguration.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/ModelAdapterFactoryConfiguration.java rename to impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactoryConfiguration.java diff --git a/src/main/java/org/apache/sling/models/impl/ModelConfigurationPrinter.java b/impl/src/main/java/org/apache/sling/models/impl/ModelConfigurationPrinter.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/ModelConfigurationPrinter.java rename to impl/src/main/java/org/apache/sling/models/impl/ModelConfigurationPrinter.java diff --git a/src/main/java/org/apache/sling/models/impl/ModelPackageBundleListener.java b/impl/src/main/java/org/apache/sling/models/impl/ModelPackageBundleListener.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/ModelPackageBundleListener.java rename to impl/src/main/java/org/apache/sling/models/impl/ModelPackageBundleListener.java diff --git a/src/main/java/org/apache/sling/models/impl/ReflectionUtil.java b/impl/src/main/java/org/apache/sling/models/impl/ReflectionUtil.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/ReflectionUtil.java rename to impl/src/main/java/org/apache/sling/models/impl/ReflectionUtil.java diff --git a/src/main/java/org/apache/sling/models/impl/ResourceOverridingJakartaRequestWrapper.java b/impl/src/main/java/org/apache/sling/models/impl/ResourceOverridingJakartaRequestWrapper.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/ResourceOverridingJakartaRequestWrapper.java rename to impl/src/main/java/org/apache/sling/models/impl/ResourceOverridingJakartaRequestWrapper.java diff --git a/src/main/java/org/apache/sling/models/impl/ResourceOverridingRequestWrapper.java b/impl/src/main/java/org/apache/sling/models/impl/ResourceOverridingRequestWrapper.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/ResourceOverridingRequestWrapper.java rename to impl/src/main/java/org/apache/sling/models/impl/ResourceOverridingRequestWrapper.java diff --git a/src/main/java/org/apache/sling/models/impl/ResourceTypeBasedResourcePicker.java b/impl/src/main/java/org/apache/sling/models/impl/ResourceTypeBasedResourcePicker.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/ResourceTypeBasedResourcePicker.java rename to impl/src/main/java/org/apache/sling/models/impl/ResourceTypeBasedResourcePicker.java diff --git a/src/main/java/org/apache/sling/models/impl/Result.java b/impl/src/main/java/org/apache/sling/models/impl/Result.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/Result.java rename to impl/src/main/java/org/apache/sling/models/impl/Result.java diff --git a/src/main/java/org/apache/sling/models/impl/SlingModelsScriptEngineFactory.java b/impl/src/main/java/org/apache/sling/models/impl/SlingModelsScriptEngineFactory.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/SlingModelsScriptEngineFactory.java rename to impl/src/main/java/org/apache/sling/models/impl/SlingModelsScriptEngineFactory.java diff --git a/src/main/java/org/apache/sling/models/impl/ThreadInvocationCounter.java b/impl/src/main/java/org/apache/sling/models/impl/ThreadInvocationCounter.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/ThreadInvocationCounter.java rename to impl/src/main/java/org/apache/sling/models/impl/ThreadInvocationCounter.java diff --git a/src/main/java/org/apache/sling/models/impl/injectors/AbstractInjector.java b/impl/src/main/java/org/apache/sling/models/impl/injectors/AbstractInjector.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/injectors/AbstractInjector.java rename to impl/src/main/java/org/apache/sling/models/impl/injectors/AbstractInjector.java diff --git a/src/main/java/org/apache/sling/models/impl/injectors/BindingsInjector.java b/impl/src/main/java/org/apache/sling/models/impl/injectors/BindingsInjector.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/injectors/BindingsInjector.java rename to impl/src/main/java/org/apache/sling/models/impl/injectors/BindingsInjector.java diff --git a/src/main/java/org/apache/sling/models/impl/injectors/ChildResourceInjector.java b/impl/src/main/java/org/apache/sling/models/impl/injectors/ChildResourceInjector.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/injectors/ChildResourceInjector.java rename to impl/src/main/java/org/apache/sling/models/impl/injectors/ChildResourceInjector.java diff --git a/src/main/java/org/apache/sling/models/impl/injectors/OSGiServiceInjector.java b/impl/src/main/java/org/apache/sling/models/impl/injectors/OSGiServiceInjector.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/injectors/OSGiServiceInjector.java rename to impl/src/main/java/org/apache/sling/models/impl/injectors/OSGiServiceInjector.java diff --git a/src/main/java/org/apache/sling/models/impl/injectors/RequestAttributeInjector.java b/impl/src/main/java/org/apache/sling/models/impl/injectors/RequestAttributeInjector.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/injectors/RequestAttributeInjector.java rename to impl/src/main/java/org/apache/sling/models/impl/injectors/RequestAttributeInjector.java diff --git a/src/main/java/org/apache/sling/models/impl/injectors/ResourcePathInjector.java b/impl/src/main/java/org/apache/sling/models/impl/injectors/ResourcePathInjector.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/injectors/ResourcePathInjector.java rename to impl/src/main/java/org/apache/sling/models/impl/injectors/ResourcePathInjector.java diff --git a/src/main/java/org/apache/sling/models/impl/injectors/SelfInjector.java b/impl/src/main/java/org/apache/sling/models/impl/injectors/SelfInjector.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/injectors/SelfInjector.java rename to impl/src/main/java/org/apache/sling/models/impl/injectors/SelfInjector.java diff --git a/src/main/java/org/apache/sling/models/impl/injectors/SlingObjectInjector.java b/impl/src/main/java/org/apache/sling/models/impl/injectors/SlingObjectInjector.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/injectors/SlingObjectInjector.java rename to impl/src/main/java/org/apache/sling/models/impl/injectors/SlingObjectInjector.java diff --git a/src/main/java/org/apache/sling/models/impl/injectors/ValueMapInjector.java b/impl/src/main/java/org/apache/sling/models/impl/injectors/ValueMapInjector.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/injectors/ValueMapInjector.java rename to impl/src/main/java/org/apache/sling/models/impl/injectors/ValueMapInjector.java diff --git a/src/main/java/org/apache/sling/models/impl/model/AbstractInjectableElement.java b/impl/src/main/java/org/apache/sling/models/impl/model/AbstractInjectableElement.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/model/AbstractInjectableElement.java rename to impl/src/main/java/org/apache/sling/models/impl/model/AbstractInjectableElement.java diff --git a/src/main/java/org/apache/sling/models/impl/model/ConstructorParameter.java b/impl/src/main/java/org/apache/sling/models/impl/model/ConstructorParameter.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/model/ConstructorParameter.java rename to impl/src/main/java/org/apache/sling/models/impl/model/ConstructorParameter.java diff --git a/src/main/java/org/apache/sling/models/impl/model/InjectableElement.java b/impl/src/main/java/org/apache/sling/models/impl/model/InjectableElement.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/model/InjectableElement.java rename to impl/src/main/java/org/apache/sling/models/impl/model/InjectableElement.java diff --git a/src/main/java/org/apache/sling/models/impl/model/InjectableField.java b/impl/src/main/java/org/apache/sling/models/impl/model/InjectableField.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/model/InjectableField.java rename to impl/src/main/java/org/apache/sling/models/impl/model/InjectableField.java diff --git a/src/main/java/org/apache/sling/models/impl/model/InjectableMethod.java b/impl/src/main/java/org/apache/sling/models/impl/model/InjectableMethod.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/model/InjectableMethod.java rename to impl/src/main/java/org/apache/sling/models/impl/model/InjectableMethod.java diff --git a/src/main/java/org/apache/sling/models/impl/model/ModelClass.java b/impl/src/main/java/org/apache/sling/models/impl/model/ModelClass.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/model/ModelClass.java rename to impl/src/main/java/org/apache/sling/models/impl/model/ModelClass.java diff --git a/src/main/java/org/apache/sling/models/impl/model/ModelClassConstructor.java b/impl/src/main/java/org/apache/sling/models/impl/model/ModelClassConstructor.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/model/ModelClassConstructor.java rename to impl/src/main/java/org/apache/sling/models/impl/model/ModelClassConstructor.java diff --git a/src/main/java/org/apache/sling/models/impl/model/OptionalTypedInjectableElement.java b/impl/src/main/java/org/apache/sling/models/impl/model/OptionalTypedInjectableElement.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/model/OptionalTypedInjectableElement.java rename to impl/src/main/java/org/apache/sling/models/impl/model/OptionalTypedInjectableElement.java diff --git a/src/main/java/org/apache/sling/models/impl/model/ParameterCountInjectComparator.java b/impl/src/main/java/org/apache/sling/models/impl/model/ParameterCountInjectComparator.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/model/ParameterCountInjectComparator.java rename to impl/src/main/java/org/apache/sling/models/impl/model/ParameterCountInjectComparator.java diff --git a/src/main/java/org/apache/sling/models/impl/via/AbstractResourceTypeViaProvider.java b/impl/src/main/java/org/apache/sling/models/impl/via/AbstractResourceTypeViaProvider.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/via/AbstractResourceTypeViaProvider.java rename to impl/src/main/java/org/apache/sling/models/impl/via/AbstractResourceTypeViaProvider.java diff --git a/src/main/java/org/apache/sling/models/impl/via/BeanPropertyViaProvider.java b/impl/src/main/java/org/apache/sling/models/impl/via/BeanPropertyViaProvider.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/via/BeanPropertyViaProvider.java rename to impl/src/main/java/org/apache/sling/models/impl/via/BeanPropertyViaProvider.java diff --git a/src/main/java/org/apache/sling/models/impl/via/ChildResourceViaProvider.java b/impl/src/main/java/org/apache/sling/models/impl/via/ChildResourceViaProvider.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/via/ChildResourceViaProvider.java rename to impl/src/main/java/org/apache/sling/models/impl/via/ChildResourceViaProvider.java diff --git a/src/main/java/org/apache/sling/models/impl/via/ForcedResourceTypeViaProvider.java b/impl/src/main/java/org/apache/sling/models/impl/via/ForcedResourceTypeViaProvider.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/via/ForcedResourceTypeViaProvider.java rename to impl/src/main/java/org/apache/sling/models/impl/via/ForcedResourceTypeViaProvider.java diff --git a/src/main/java/org/apache/sling/models/impl/via/OriginalResourceTypeViaProvider.java b/impl/src/main/java/org/apache/sling/models/impl/via/OriginalResourceTypeViaProvider.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/via/OriginalResourceTypeViaProvider.java rename to impl/src/main/java/org/apache/sling/models/impl/via/OriginalResourceTypeViaProvider.java diff --git a/src/main/java/org/apache/sling/models/impl/via/ResourceSuperTypeViaProvider.java b/impl/src/main/java/org/apache/sling/models/impl/via/ResourceSuperTypeViaProvider.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/via/ResourceSuperTypeViaProvider.java rename to impl/src/main/java/org/apache/sling/models/impl/via/ResourceSuperTypeViaProvider.java diff --git a/src/main/java/org/apache/sling/models/impl/via/ResourceTypeForcingJakartaRequestWrapper.java b/impl/src/main/java/org/apache/sling/models/impl/via/ResourceTypeForcingJakartaRequestWrapper.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/via/ResourceTypeForcingJakartaRequestWrapper.java rename to impl/src/main/java/org/apache/sling/models/impl/via/ResourceTypeForcingJakartaRequestWrapper.java diff --git a/src/main/java/org/apache/sling/models/impl/via/ResourceTypeForcingRequestWrapper.java b/impl/src/main/java/org/apache/sling/models/impl/via/ResourceTypeForcingRequestWrapper.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/via/ResourceTypeForcingRequestWrapper.java rename to impl/src/main/java/org/apache/sling/models/impl/via/ResourceTypeForcingRequestWrapper.java diff --git a/src/main/java/org/apache/sling/models/impl/via/ResourceTypeForcingResourceWrapper.java b/impl/src/main/java/org/apache/sling/models/impl/via/ResourceTypeForcingResourceWrapper.java similarity index 100% rename from src/main/java/org/apache/sling/models/impl/via/ResourceTypeForcingResourceWrapper.java rename to impl/src/main/java/org/apache/sling/models/impl/via/ResourceTypeForcingResourceWrapper.java diff --git a/src/test/java/org/apache/sling/models/impl/AdapterFactoryTest.java b/impl/src/test/java/org/apache/sling/models/impl/AdapterFactoryTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/AdapterFactoryTest.java rename to impl/src/test/java/org/apache/sling/models/impl/AdapterFactoryTest.java diff --git a/src/test/java/org/apache/sling/models/impl/AdapterImplementationsTest.java b/impl/src/test/java/org/apache/sling/models/impl/AdapterImplementationsTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/AdapterImplementationsTest.java rename to impl/src/test/java/org/apache/sling/models/impl/AdapterImplementationsTest.java diff --git a/src/test/java/org/apache/sling/models/impl/AnnotationConflictsTest.java b/impl/src/test/java/org/apache/sling/models/impl/AnnotationConflictsTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/AnnotationConflictsTest.java rename to impl/src/test/java/org/apache/sling/models/impl/AnnotationConflictsTest.java diff --git a/src/test/java/org/apache/sling/models/impl/CachingTest.java b/impl/src/test/java/org/apache/sling/models/impl/CachingTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/CachingTest.java rename to impl/src/test/java/org/apache/sling/models/impl/CachingTest.java diff --git a/src/test/java/org/apache/sling/models/impl/ConstructorTest.java b/impl/src/test/java/org/apache/sling/models/impl/ConstructorTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/ConstructorTest.java rename to impl/src/test/java/org/apache/sling/models/impl/ConstructorTest.java diff --git a/src/test/java/org/apache/sling/models/impl/ConstructorVisibilityTest.java b/impl/src/test/java/org/apache/sling/models/impl/ConstructorVisibilityTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/ConstructorVisibilityTest.java rename to impl/src/test/java/org/apache/sling/models/impl/ConstructorVisibilityTest.java diff --git a/src/test/java/org/apache/sling/models/impl/CustomInjectorTest.java b/impl/src/test/java/org/apache/sling/models/impl/CustomInjectorTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/CustomInjectorTest.java rename to impl/src/test/java/org/apache/sling/models/impl/CustomInjectorTest.java diff --git a/src/test/java/org/apache/sling/models/impl/DefaultInterfaceMethodTest.java b/impl/src/test/java/org/apache/sling/models/impl/DefaultInterfaceMethodTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/DefaultInterfaceMethodTest.java rename to impl/src/test/java/org/apache/sling/models/impl/DefaultInterfaceMethodTest.java diff --git a/src/test/java/org/apache/sling/models/impl/DefaultTest.java b/impl/src/test/java/org/apache/sling/models/impl/DefaultTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/DefaultTest.java rename to impl/src/test/java/org/apache/sling/models/impl/DefaultTest.java diff --git a/src/test/java/org/apache/sling/models/impl/ExtraDefaultTests.java b/impl/src/test/java/org/apache/sling/models/impl/ExtraDefaultTests.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/ExtraDefaultTests.java rename to impl/src/test/java/org/apache/sling/models/impl/ExtraDefaultTests.java diff --git a/src/test/java/org/apache/sling/models/impl/ImplementsExtendsTest.java b/impl/src/test/java/org/apache/sling/models/impl/ImplementsExtendsTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/ImplementsExtendsTest.java rename to impl/src/test/java/org/apache/sling/models/impl/ImplementsExtendsTest.java diff --git a/src/test/java/org/apache/sling/models/impl/InjectorSpecificAnnotationTest.java b/impl/src/test/java/org/apache/sling/models/impl/InjectorSpecificAnnotationTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/InjectorSpecificAnnotationTest.java rename to impl/src/test/java/org/apache/sling/models/impl/InjectorSpecificAnnotationTest.java diff --git a/src/test/java/org/apache/sling/models/impl/InterfaceInheritanceTest.java b/impl/src/test/java/org/apache/sling/models/impl/InterfaceInheritanceTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/InterfaceInheritanceTest.java rename to impl/src/test/java/org/apache/sling/models/impl/InterfaceInheritanceTest.java diff --git a/src/test/java/org/apache/sling/models/impl/InvalidAdaptationsTest.java b/impl/src/test/java/org/apache/sling/models/impl/InvalidAdaptationsTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/InvalidAdaptationsTest.java rename to impl/src/test/java/org/apache/sling/models/impl/InvalidAdaptationsTest.java diff --git a/src/test/java/org/apache/sling/models/impl/ModelAdapterFactoryTest.java b/impl/src/test/java/org/apache/sling/models/impl/ModelAdapterFactoryTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/ModelAdapterFactoryTest.java rename to impl/src/test/java/org/apache/sling/models/impl/ModelAdapterFactoryTest.java diff --git a/src/test/java/org/apache/sling/models/impl/ModelAdapterFactory_ImplementationPickerOrderTest.java b/impl/src/test/java/org/apache/sling/models/impl/ModelAdapterFactory_ImplementationPickerOrderTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/ModelAdapterFactory_ImplementationPickerOrderTest.java rename to impl/src/test/java/org/apache/sling/models/impl/ModelAdapterFactory_ImplementationPickerOrderTest.java diff --git a/src/test/java/org/apache/sling/models/impl/ModelAdapterFactory_InjectorOrderTest.java b/impl/src/test/java/org/apache/sling/models/impl/ModelAdapterFactory_InjectorOrderTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/ModelAdapterFactory_InjectorOrderTest.java rename to impl/src/test/java/org/apache/sling/models/impl/ModelAdapterFactory_InjectorOrderTest.java diff --git a/src/test/java/org/apache/sling/models/impl/ModelPackageBundleListenerTest.java b/impl/src/test/java/org/apache/sling/models/impl/ModelPackageBundleListenerTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/ModelPackageBundleListenerTest.java rename to impl/src/test/java/org/apache/sling/models/impl/ModelPackageBundleListenerTest.java diff --git a/src/test/java/org/apache/sling/models/impl/MultipleInjectorTest.java b/impl/src/test/java/org/apache/sling/models/impl/MultipleInjectorTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/MultipleInjectorTest.java rename to impl/src/test/java/org/apache/sling/models/impl/MultipleInjectorTest.java diff --git a/src/test/java/org/apache/sling/models/impl/OSGiInjectionTest.java b/impl/src/test/java/org/apache/sling/models/impl/OSGiInjectionTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/OSGiInjectionTest.java rename to impl/src/test/java/org/apache/sling/models/impl/OSGiInjectionTest.java diff --git a/src/test/java/org/apache/sling/models/impl/OptionalObjectsTest.java b/impl/src/test/java/org/apache/sling/models/impl/OptionalObjectsTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/OptionalObjectsTest.java rename to impl/src/test/java/org/apache/sling/models/impl/OptionalObjectsTest.java diff --git a/src/test/java/org/apache/sling/models/impl/OptionalPrimitivesTest.java b/impl/src/test/java/org/apache/sling/models/impl/OptionalPrimitivesTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/OptionalPrimitivesTest.java rename to impl/src/test/java/org/apache/sling/models/impl/OptionalPrimitivesTest.java diff --git a/src/test/java/org/apache/sling/models/impl/ParameterizedTypeFromRequestAttributeTest.java b/impl/src/test/java/org/apache/sling/models/impl/ParameterizedTypeFromRequestAttributeTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/ParameterizedTypeFromRequestAttributeTest.java rename to impl/src/test/java/org/apache/sling/models/impl/ParameterizedTypeFromRequestAttributeTest.java diff --git a/src/test/java/org/apache/sling/models/impl/PostConstructTest.java b/impl/src/test/java/org/apache/sling/models/impl/PostConstructTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/PostConstructTest.java rename to impl/src/test/java/org/apache/sling/models/impl/PostConstructTest.java diff --git a/src/test/java/org/apache/sling/models/impl/ReflectionUtilTest.java b/impl/src/test/java/org/apache/sling/models/impl/ReflectionUtilTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/ReflectionUtilTest.java rename to impl/src/test/java/org/apache/sling/models/impl/ReflectionUtilTest.java diff --git a/src/test/java/org/apache/sling/models/impl/RequestDisposalTest.java b/impl/src/test/java/org/apache/sling/models/impl/RequestDisposalTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/RequestDisposalTest.java rename to impl/src/test/java/org/apache/sling/models/impl/RequestDisposalTest.java diff --git a/src/test/java/org/apache/sling/models/impl/RequestInjectionTest.java b/impl/src/test/java/org/apache/sling/models/impl/RequestInjectionTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/RequestInjectionTest.java rename to impl/src/test/java/org/apache/sling/models/impl/RequestInjectionTest.java diff --git a/src/test/java/org/apache/sling/models/impl/RequestWrapperTest.java b/impl/src/test/java/org/apache/sling/models/impl/RequestWrapperTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/RequestWrapperTest.java rename to impl/src/test/java/org/apache/sling/models/impl/RequestWrapperTest.java diff --git a/src/test/java/org/apache/sling/models/impl/ResourceModelClassesTest.java b/impl/src/test/java/org/apache/sling/models/impl/ResourceModelClassesTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/ResourceModelClassesTest.java rename to impl/src/test/java/org/apache/sling/models/impl/ResourceModelClassesTest.java diff --git a/src/test/java/org/apache/sling/models/impl/ResourceModelConstructorTest.java b/impl/src/test/java/org/apache/sling/models/impl/ResourceModelConstructorTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/ResourceModelConstructorTest.java rename to impl/src/test/java/org/apache/sling/models/impl/ResourceModelConstructorTest.java diff --git a/src/test/java/org/apache/sling/models/impl/ResourceModelInterfacesTest.java b/impl/src/test/java/org/apache/sling/models/impl/ResourceModelInterfacesTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/ResourceModelInterfacesTest.java rename to impl/src/test/java/org/apache/sling/models/impl/ResourceModelInterfacesTest.java diff --git a/src/test/java/org/apache/sling/models/impl/ResourceOverridingJakartaRequestWrapperTest.java b/impl/src/test/java/org/apache/sling/models/impl/ResourceOverridingJakartaRequestWrapperTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/ResourceOverridingJakartaRequestWrapperTest.java rename to impl/src/test/java/org/apache/sling/models/impl/ResourceOverridingJakartaRequestWrapperTest.java diff --git a/src/test/java/org/apache/sling/models/impl/ResourceOverridingRequestWrapperTest.java b/impl/src/test/java/org/apache/sling/models/impl/ResourceOverridingRequestWrapperTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/ResourceOverridingRequestWrapperTest.java rename to impl/src/test/java/org/apache/sling/models/impl/ResourceOverridingRequestWrapperTest.java diff --git a/src/test/java/org/apache/sling/models/impl/ResourcePathInjectionTest.java b/impl/src/test/java/org/apache/sling/models/impl/ResourcePathInjectionTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/ResourcePathInjectionTest.java rename to impl/src/test/java/org/apache/sling/models/impl/ResourcePathInjectionTest.java diff --git a/src/test/java/org/apache/sling/models/impl/SelfDependencyTest.java b/impl/src/test/java/org/apache/sling/models/impl/SelfDependencyTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/SelfDependencyTest.java rename to impl/src/test/java/org/apache/sling/models/impl/SelfDependencyTest.java diff --git a/src/test/java/org/apache/sling/models/impl/ServicePropertiesMap.java b/impl/src/test/java/org/apache/sling/models/impl/ServicePropertiesMap.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/ServicePropertiesMap.java rename to impl/src/test/java/org/apache/sling/models/impl/ServicePropertiesMap.java diff --git a/src/test/java/org/apache/sling/models/impl/StaticInjectionAPFLoadOrderTest.java b/impl/src/test/java/org/apache/sling/models/impl/StaticInjectionAPFLoadOrderTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/StaticInjectionAPFLoadOrderTest.java rename to impl/src/test/java/org/apache/sling/models/impl/StaticInjectionAPFLoadOrderTest.java diff --git a/src/test/java/org/apache/sling/models/impl/ViaTest.java b/impl/src/test/java/org/apache/sling/models/impl/ViaTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/ViaTest.java rename to impl/src/test/java/org/apache/sling/models/impl/ViaTest.java diff --git a/src/test/java/org/apache/sling/models/impl/implpicker/FirstImplementationPickerTest.java b/impl/src/test/java/org/apache/sling/models/impl/implpicker/FirstImplementationPickerTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/implpicker/FirstImplementationPickerTest.java rename to impl/src/test/java/org/apache/sling/models/impl/implpicker/FirstImplementationPickerTest.java diff --git a/src/test/java/org/apache/sling/models/impl/injector/CustomAnnotation.java b/impl/src/test/java/org/apache/sling/models/impl/injector/CustomAnnotation.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/injector/CustomAnnotation.java rename to impl/src/test/java/org/apache/sling/models/impl/injector/CustomAnnotation.java diff --git a/src/test/java/org/apache/sling/models/impl/injector/CustomAnnotationInjector.java b/impl/src/test/java/org/apache/sling/models/impl/injector/CustomAnnotationInjector.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/injector/CustomAnnotationInjector.java rename to impl/src/test/java/org/apache/sling/models/impl/injector/CustomAnnotationInjector.java diff --git a/src/test/java/org/apache/sling/models/impl/injector/SimpleInjector.java b/impl/src/test/java/org/apache/sling/models/impl/injector/SimpleInjector.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/injector/SimpleInjector.java rename to impl/src/test/java/org/apache/sling/models/impl/injector/SimpleInjector.java diff --git a/src/test/java/org/apache/sling/models/impl/injectors/BindingsInjectorTest.java b/impl/src/test/java/org/apache/sling/models/impl/injectors/BindingsInjectorTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/injectors/BindingsInjectorTest.java rename to impl/src/test/java/org/apache/sling/models/impl/injectors/BindingsInjectorTest.java diff --git a/src/test/java/org/apache/sling/models/impl/injectors/RequestAttributeInjectorTest.java b/impl/src/test/java/org/apache/sling/models/impl/injectors/RequestAttributeInjectorTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/injectors/RequestAttributeInjectorTest.java rename to impl/src/test/java/org/apache/sling/models/impl/injectors/RequestAttributeInjectorTest.java diff --git a/src/test/java/org/apache/sling/models/impl/injectors/ResourcePathInjectorTest.java b/impl/src/test/java/org/apache/sling/models/impl/injectors/ResourcePathInjectorTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/injectors/ResourcePathInjectorTest.java rename to impl/src/test/java/org/apache/sling/models/impl/injectors/ResourcePathInjectorTest.java diff --git a/src/test/java/org/apache/sling/models/impl/injectors/ResourceResolverInjectorTest.java b/impl/src/test/java/org/apache/sling/models/impl/injectors/ResourceResolverInjectorTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/injectors/ResourceResolverInjectorTest.java rename to impl/src/test/java/org/apache/sling/models/impl/injectors/ResourceResolverInjectorTest.java diff --git a/src/test/java/org/apache/sling/models/impl/injectors/SelfInjectorTest.java b/impl/src/test/java/org/apache/sling/models/impl/injectors/SelfInjectorTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/injectors/SelfInjectorTest.java rename to impl/src/test/java/org/apache/sling/models/impl/injectors/SelfInjectorTest.java diff --git a/src/test/java/org/apache/sling/models/impl/injectors/SlingObjectInjectorRequestTest.java b/impl/src/test/java/org/apache/sling/models/impl/injectors/SlingObjectInjectorRequestTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/injectors/SlingObjectInjectorRequestTest.java rename to impl/src/test/java/org/apache/sling/models/impl/injectors/SlingObjectInjectorRequestTest.java diff --git a/src/test/java/org/apache/sling/models/impl/injectors/SlingObjectInjectorResourceResolverTest.java b/impl/src/test/java/org/apache/sling/models/impl/injectors/SlingObjectInjectorResourceResolverTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/injectors/SlingObjectInjectorResourceResolverTest.java rename to impl/src/test/java/org/apache/sling/models/impl/injectors/SlingObjectInjectorResourceResolverTest.java diff --git a/src/test/java/org/apache/sling/models/impl/injectors/SlingObjectInjectorResourceTest.java b/impl/src/test/java/org/apache/sling/models/impl/injectors/SlingObjectInjectorResourceTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/injectors/SlingObjectInjectorResourceTest.java rename to impl/src/test/java/org/apache/sling/models/impl/injectors/SlingObjectInjectorResourceTest.java diff --git a/src/test/java/org/apache/sling/models/impl/injectors/ValueMapInjectorTest.java b/impl/src/test/java/org/apache/sling/models/impl/injectors/ValueMapInjectorTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/injectors/ValueMapInjectorTest.java rename to impl/src/test/java/org/apache/sling/models/impl/injectors/ValueMapInjectorTest.java diff --git a/src/test/java/org/apache/sling/models/impl/via/AbstractResourceTypeViaProviderTest.java b/impl/src/test/java/org/apache/sling/models/impl/via/AbstractResourceTypeViaProviderTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/via/AbstractResourceTypeViaProviderTest.java rename to impl/src/test/java/org/apache/sling/models/impl/via/AbstractResourceTypeViaProviderTest.java diff --git a/src/test/java/org/apache/sling/models/impl/via/BeanPropertyViaProviderTest.java b/impl/src/test/java/org/apache/sling/models/impl/via/BeanPropertyViaProviderTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/via/BeanPropertyViaProviderTest.java rename to impl/src/test/java/org/apache/sling/models/impl/via/BeanPropertyViaProviderTest.java diff --git a/src/test/java/org/apache/sling/models/impl/via/ChildResourceViaProviderTest.java b/impl/src/test/java/org/apache/sling/models/impl/via/ChildResourceViaProviderTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/via/ChildResourceViaProviderTest.java rename to impl/src/test/java/org/apache/sling/models/impl/via/ChildResourceViaProviderTest.java diff --git a/src/test/java/org/apache/sling/models/impl/via/ForcedResourceTypeViaProviderTest.java b/impl/src/test/java/org/apache/sling/models/impl/via/ForcedResourceTypeViaProviderTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/via/ForcedResourceTypeViaProviderTest.java rename to impl/src/test/java/org/apache/sling/models/impl/via/ForcedResourceTypeViaProviderTest.java diff --git a/src/test/java/org/apache/sling/models/impl/via/OriginalResourceTypeViaProviderTest.java b/impl/src/test/java/org/apache/sling/models/impl/via/OriginalResourceTypeViaProviderTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/via/OriginalResourceTypeViaProviderTest.java rename to impl/src/test/java/org/apache/sling/models/impl/via/OriginalResourceTypeViaProviderTest.java diff --git a/src/test/java/org/apache/sling/models/impl/via/ResourceSuperTypeViaProviderTest.java b/impl/src/test/java/org/apache/sling/models/impl/via/ResourceSuperTypeViaProviderTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/via/ResourceSuperTypeViaProviderTest.java rename to impl/src/test/java/org/apache/sling/models/impl/via/ResourceSuperTypeViaProviderTest.java diff --git a/src/test/java/org/apache/sling/models/impl/via/ResourceTypeForcingJakartaRequestWrapperTest.java b/impl/src/test/java/org/apache/sling/models/impl/via/ResourceTypeForcingJakartaRequestWrapperTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/via/ResourceTypeForcingJakartaRequestWrapperTest.java rename to impl/src/test/java/org/apache/sling/models/impl/via/ResourceTypeForcingJakartaRequestWrapperTest.java diff --git a/src/test/java/org/apache/sling/models/impl/via/ResourceTypeForcingRequestWrapperTest.java b/impl/src/test/java/org/apache/sling/models/impl/via/ResourceTypeForcingRequestWrapperTest.java similarity index 100% rename from src/test/java/org/apache/sling/models/impl/via/ResourceTypeForcingRequestWrapperTest.java rename to impl/src/test/java/org/apache/sling/models/impl/via/ResourceTypeForcingRequestWrapperTest.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/ArrayOSGiModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/ArrayOSGiModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/ArrayOSGiModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/ArrayOSGiModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/ArrayPrimitivesModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/ArrayPrimitivesModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/ArrayPrimitivesModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/ArrayPrimitivesModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/ArrayWrappersModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/ArrayWrappersModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/ArrayWrappersModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/ArrayWrappersModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/BindingsModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/BindingsModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/BindingsModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/BindingsModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/CachedModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/CachedModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/CachedModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/CachedModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/CachedModelWithAdapterTypes12.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/CachedModelWithAdapterTypes12.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/CachedModelWithAdapterTypes12.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/CachedModelWithAdapterTypes12.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/CachedModelWithAdapterTypes23.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/CachedModelWithAdapterTypes23.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/CachedModelWithAdapterTypes23.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/CachedModelWithAdapterTypes23.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/CachedModelWithSelfReference.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/CachedModelWithSelfReference.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/CachedModelWithSelfReference.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/CachedModelWithSelfReference.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/ChildModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/ChildModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/ChildModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/ChildModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/ChildResourceModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/ChildResourceModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/ChildResourceModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/ChildResourceModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/ChildResourceViaModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/ChildResourceViaModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/ChildResourceViaModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/ChildResourceViaModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/ChildValueMapModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/ChildValueMapModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/ChildValueMapModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/ChildValueMapModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/CollectionDefaultsModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/CollectionDefaultsModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/CollectionDefaultsModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/CollectionDefaultsModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/CollectionOSGiModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/CollectionOSGiModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/CollectionOSGiModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/CollectionOSGiModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/ConstructorWithExceptionModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/ConstructorWithExceptionModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/ConstructorWithExceptionModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/ConstructorWithExceptionModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/DefaultPrimitivesModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/DefaultPrimitivesModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/DefaultPrimitivesModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/DefaultPrimitivesModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/DefaultStringModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/DefaultStringModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/DefaultStringModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/DefaultStringModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/DefaultWrappersModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/DefaultWrappersModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/DefaultWrappersModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/DefaultWrappersModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/DirectCyclicSelfDependencyModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/DirectCyclicSelfDependencyModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/DirectCyclicSelfDependencyModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/DirectCyclicSelfDependencyModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/FailingPostConstructModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/FailingPostConstructModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/FailingPostConstructModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/FailingPostConstructModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/FalsePostConstructModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/FalsePostConstructModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/FalsePostConstructModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/FalsePostConstructModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/IndirectCyclicSelfDependencyModelA.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/IndirectCyclicSelfDependencyModelA.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/IndirectCyclicSelfDependencyModelA.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/IndirectCyclicSelfDependencyModelA.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/IndirectCyclicSelfDependencyModelB.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/IndirectCyclicSelfDependencyModelB.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/IndirectCyclicSelfDependencyModelB.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/IndirectCyclicSelfDependencyModelB.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/InjectorSpecificAnnotationModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/InjectorSpecificAnnotationModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/InjectorSpecificAnnotationModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/InjectorSpecificAnnotationModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/InvalidConstructorModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/InvalidConstructorModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/InvalidConstructorModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/InvalidConstructorModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/InvalidModelWithMissingAnnotation.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/InvalidModelWithMissingAnnotation.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/InvalidModelWithMissingAnnotation.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/InvalidModelWithMissingAnnotation.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/ListDefaultsModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/ListDefaultsModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/ListDefaultsModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/ListDefaultsModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/ListModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/ListModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/ListModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/ListModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/ListOSGiModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/ListOSGiModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/ListOSGiModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/ListOSGiModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/OptionalArrayOSGiModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/OptionalArrayOSGiModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/OptionalArrayOSGiModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/OptionalArrayOSGiModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/OptionalListOSGiModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/OptionalListOSGiModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/OptionalListOSGiModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/OptionalListOSGiModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/OptionalObjectsModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/OptionalObjectsModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/OptionalObjectsModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/OptionalObjectsModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/OptionalPrimitivesModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/OptionalPrimitivesModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/OptionalPrimitivesModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/OptionalPrimitivesModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/ParentModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/ParentModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/ParentModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/ParentModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/RequestOSGiModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/RequestOSGiModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/RequestOSGiModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/RequestOSGiModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/ResourceModelWithRequiredField.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/ResourceModelWithRequiredField.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/ResourceModelWithRequiredField.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/ResourceModelWithRequiredField.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/ResourceModelWithRequiredFieldOptionalStrategy.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/ResourceModelWithRequiredFieldOptionalStrategy.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/ResourceModelWithRequiredFieldOptionalStrategy.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/ResourceModelWithRequiredFieldOptionalStrategy.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/ResourcePathAllOptionalModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/ResourcePathAllOptionalModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/ResourcePathAllOptionalModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/ResourcePathAllOptionalModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/ResourcePathModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/ResourcePathModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/ResourcePathModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/ResourcePathModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/ResourcePathModelWrapping.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/ResourcePathModelWrapping.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/ResourcePathModelWrapping.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/ResourcePathModelWrapping.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/ResourcePathPartialModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/ResourcePathPartialModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/ResourcePathPartialModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/ResourcePathPartialModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/SelfDependencyModelA.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/SelfDependencyModelA.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/SelfDependencyModelA.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/SelfDependencyModelA.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/SelfDependencyModelB.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/SelfDependencyModelB.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/SelfDependencyModelB.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/SelfDependencyModelB.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/SetOSGiModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/SetOSGiModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/SetOSGiModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/SetOSGiModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/SimpleModelWithInvalidSecondAnnotation.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/SimpleModelWithInvalidSecondAnnotation.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/SimpleModelWithInvalidSecondAnnotation.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/SimpleModelWithInvalidSecondAnnotation.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/SimpleOSGiModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/SimpleOSGiModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/SimpleOSGiModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/SimpleOSGiModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/SimplePropertyModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/SimplePropertyModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/SimplePropertyModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/SimplePropertyModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/SubClass.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/SubClass.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/SubClass.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/SubClass.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/SubClassOverriddenPostConstruct.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/SubClassOverriddenPostConstruct.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/SubClassOverriddenPostConstruct.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/SubClassOverriddenPostConstruct.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/SuperClass.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/SuperClass.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/SuperClass.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/SuperClass.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/SuperclassConstructorModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/SuperclassConstructorModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/SuperclassConstructorModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/SuperclassConstructorModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/TruePostConstructModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/TruePostConstructModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/TruePostConstructModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/TruePostConstructModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/UncachedModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/UncachedModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/UncachedModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/UncachedModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/ViaModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/ViaModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/ViaModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/ViaModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/WithOneConstructorModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/WithOneConstructorModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/WithOneConstructorModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/WithOneConstructorModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/WithThreeConstructorsModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/WithThreeConstructorsModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/WithThreeConstructorsModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/WithThreeConstructorsModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/WithTwoConstructorsModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/WithTwoConstructorsModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/WithTwoConstructorsModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/WithTwoConstructorsModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/annotations/Hidden.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/annotations/Hidden.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/annotations/Hidden.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/annotations/Hidden.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/annotations/OtherAnnotation.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/annotations/OtherAnnotation.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/annotations/OtherAnnotation.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/annotations/OtherAnnotation.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/BindingsModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/BindingsModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/BindingsModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/BindingsModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/DefaultPrimitivesModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/DefaultPrimitivesModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/DefaultPrimitivesModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/DefaultPrimitivesModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/DefaultStringModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/DefaultStringModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/DefaultStringModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/DefaultStringModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/DefaultWrappersModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/DefaultWrappersModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/DefaultWrappersModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/DefaultWrappersModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/InjectorSpecificAnnotationModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/InjectorSpecificAnnotationModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/InjectorSpecificAnnotationModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/InjectorSpecificAnnotationModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/ListOSGiModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/ListOSGiModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/ListOSGiModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/ListOSGiModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/NoNameModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/NoNameModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/NoNameModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/NoNameModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/OptionalPrimitivesModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/OptionalPrimitivesModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/OptionalPrimitivesModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/OptionalPrimitivesModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/ParentModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/ParentModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/ParentModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/ParentModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/SimpleOSGiModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/SimpleOSGiModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/SimpleOSGiModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/SimpleOSGiModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/ViaRequestSuffixModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/ViaRequestSuffixModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/ViaRequestSuffixModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/ViaRequestSuffixModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/WithThreeConstructorsOneInjectModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/WithThreeConstructorsOneInjectModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/WithThreeConstructorsOneInjectModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorinjection/WithThreeConstructorsOneInjectModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/constructorvisibility/PackagePrivateConstructorModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorvisibility/PackagePrivateConstructorModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/constructorvisibility/PackagePrivateConstructorModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorvisibility/PackagePrivateConstructorModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/constructorvisibility/PrivateConstructorModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorvisibility/PrivateConstructorModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/constructorvisibility/PrivateConstructorModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorvisibility/PrivateConstructorModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/constructorvisibility/ProtectedConstructorModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorvisibility/ProtectedConstructorModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/constructorvisibility/ProtectedConstructorModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/constructorvisibility/ProtectedConstructorModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/implextend/EvenSimplerPropertyModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/implextend/EvenSimplerPropertyModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/implextend/EvenSimplerPropertyModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/implextend/EvenSimplerPropertyModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/implextend/ExtendsClassPropertyModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/implextend/ExtendsClassPropertyModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/implextend/ExtendsClassPropertyModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/implextend/ExtendsClassPropertyModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/implextend/ImplementsInterfacePropertyModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/implextend/ImplementsInterfacePropertyModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/implextend/ImplementsInterfacePropertyModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/implextend/ImplementsInterfacePropertyModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/implextend/ImplementsInterfacePropertyModel2.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/implextend/ImplementsInterfacePropertyModel2.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/implextend/ImplementsInterfacePropertyModel2.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/implextend/ImplementsInterfacePropertyModel2.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/implextend/InvalidImplementsInterfacePropertyModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/implextend/InvalidImplementsInterfacePropertyModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/implextend/InvalidImplementsInterfacePropertyModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/implextend/InvalidImplementsInterfacePropertyModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/implextend/InvalidSampleServiceInterface.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/implextend/InvalidSampleServiceInterface.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/implextend/InvalidSampleServiceInterface.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/implextend/InvalidSampleServiceInterface.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/implextend/SampleServiceInterface.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/implextend/SampleServiceInterface.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/implextend/SampleServiceInterface.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/implextend/SampleServiceInterface.java diff --git a/src/test/java/org/apache/sling/models/testmodels/classes/implextend/SimplePropertyModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/classes/implextend/SimplePropertyModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/classes/implextend/SimplePropertyModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/classes/implextend/SimplePropertyModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/interfaces/AdapterType1.java b/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/AdapterType1.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/interfaces/AdapterType1.java rename to impl/src/test/java/org/apache/sling/models/testmodels/interfaces/AdapterType1.java diff --git a/src/test/java/org/apache/sling/models/testmodels/interfaces/AdapterType2.java b/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/AdapterType2.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/interfaces/AdapterType2.java rename to impl/src/test/java/org/apache/sling/models/testmodels/interfaces/AdapterType2.java diff --git a/src/test/java/org/apache/sling/models/testmodels/interfaces/AdapterType3.java b/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/AdapterType3.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/interfaces/AdapterType3.java rename to impl/src/test/java/org/apache/sling/models/testmodels/interfaces/AdapterType3.java diff --git a/src/test/java/org/apache/sling/models/testmodels/interfaces/CachedModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/CachedModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/interfaces/CachedModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/interfaces/CachedModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/interfaces/ChildModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/ChildModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/interfaces/ChildModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/interfaces/ChildModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/interfaces/ChildResourceModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/ChildResourceModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/interfaces/ChildResourceModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/interfaces/ChildResourceModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/interfaces/ChildValueMapModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/ChildValueMapModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/interfaces/ChildValueMapModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/interfaces/ChildValueMapModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/interfaces/ModelWithDefaultMethods.java b/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/ModelWithDefaultMethods.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/interfaces/ModelWithDefaultMethods.java rename to impl/src/test/java/org/apache/sling/models/testmodels/interfaces/ModelWithDefaultMethods.java diff --git a/src/test/java/org/apache/sling/models/testmodels/interfaces/OptionalPrimitivesModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/OptionalPrimitivesModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/interfaces/OptionalPrimitivesModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/interfaces/OptionalPrimitivesModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/interfaces/ParentModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/ParentModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/interfaces/ParentModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/interfaces/ParentModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/interfaces/PropertyModelWithDefaults.java b/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/PropertyModelWithDefaults.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/interfaces/PropertyModelWithDefaults.java rename to impl/src/test/java/org/apache/sling/models/testmodels/interfaces/PropertyModelWithDefaults.java diff --git a/src/test/java/org/apache/sling/models/testmodels/interfaces/ResourceModelWithRequiredField.java b/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/ResourceModelWithRequiredField.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/interfaces/ResourceModelWithRequiredField.java rename to impl/src/test/java/org/apache/sling/models/testmodels/interfaces/ResourceModelWithRequiredField.java diff --git a/src/test/java/org/apache/sling/models/testmodels/interfaces/ServiceInterface.java b/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/ServiceInterface.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/interfaces/ServiceInterface.java rename to impl/src/test/java/org/apache/sling/models/testmodels/interfaces/ServiceInterface.java diff --git a/src/test/java/org/apache/sling/models/testmodels/interfaces/SimplePropertyModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/SimplePropertyModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/interfaces/SimplePropertyModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/interfaces/SimplePropertyModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/interfaces/SubClassModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/SubClassModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/interfaces/SubClassModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/interfaces/SubClassModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/interfaces/SuperClassModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/SuperClassModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/interfaces/SuperClassModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/interfaces/SuperClassModel.java diff --git a/src/test/java/org/apache/sling/models/testmodels/interfaces/UncachedModel.java b/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/UncachedModel.java similarity index 100% rename from src/test/java/org/apache/sling/models/testmodels/interfaces/UncachedModel.java rename to impl/src/test/java/org/apache/sling/models/testmodels/interfaces/UncachedModel.java diff --git a/src/test/java/org/apache/sling/models/testutil/ModelAdapterFactoryUtil.java b/impl/src/test/java/org/apache/sling/models/testutil/ModelAdapterFactoryUtil.java similarity index 100% rename from src/test/java/org/apache/sling/models/testutil/ModelAdapterFactoryUtil.java rename to impl/src/test/java/org/apache/sling/models/testutil/ModelAdapterFactoryUtil.java diff --git a/parent/pom.xml b/parent/pom.xml new file mode 100644 index 00000000..b6c772b5 --- /dev/null +++ b/parent/pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + + org.apache.sling + sling-bundle-parent + 62 + + + + org.apache.sling.models.impl.parent + 2.0.1-SNAPSHOT + pom + Apache Sling Models Implementation - Parent + + + scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-impl.git + scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-impl.git + HEAD + https://github.com/apache/sling-org-apache-sling-models-impl.git + + + + 2025-08-27T03:14:05Z + 17 + + + + + org.apache.sling + org.apache.sling.models.api + 2.0.0 + provided + + + diff --git a/pom.xml b/pom.xml index 2e3f5c22..a7f30b43 100644 --- a/pom.xml +++ b/pom.xml @@ -19,250 +19,21 @@ --> 4.0.0 + org.apache.sling - sling-bundle-parent - 62 - + org.apache.sling.models.impl.parent + 2.0.1-SNAPSHOT + parent/pom.xml - org.apache.sling.models.impl - 2.0.1-SNAPSHOT - Apache Sling Models Implementation - Apache Sling Models Implementation - - scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-impl.git - scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-impl.git - org.apache.sling.models.impl-1.7.2 - https://github.com/apache/sling-org-apache-sling-models-impl.git - - - 2025-08-27T03:14:05Z - 17 - + org.apache.sling.models.impl.reactor + 2.0.1-SNAPSHOT + pom + Apache Sling Models Implementation - Reactor - - - org.apache.sling - org.apache.sling.models.api - 2.0.0 - provided - - - org.osgi - org.osgi.framework - provided - - - org.osgi - org.osgi.service.component - provided - - - org.osgi - org.osgi.util.tracker - provided - - - org.osgi - org.osgi.service.http.whiteboard - provided - - - - org.osgi - org.osgi.service.component.annotations - provided - - - org.osgi - org.osgi.service.metatype.annotations - provided - - - org.osgi - org.osgi.annotation.versioning - provided - - - - javax.servlet - javax.servlet-api - 4.0.1 - provided - - - jakarta.servlet - jakarta.servlet-api - 6.0.0 - provided - - - org.apache.felix - org.apache.felix.http.wrappers - 1.1.10 - provided - - - org.apache.commons - commons-lang3 - 3.18.0 - provided - - - org.apache.sling - org.apache.sling.api - 3.0.0 - provided - - - org.apache.sling - org.apache.sling.scripting.api - 2.2.0 - provided - - - org.slf4j - slf4j-api - provided - - - javax.inject - javax.inject - provided - - - org.osgi - org.osgi.util.converter - provided - - - - org.apache.sling - org.apache.sling.scripting.core - 3.0.0 - compile - - - org.apache.felix - org.apache.felix.utils - - - - - org.jetbrains - annotations - provided - - - - junit - junit - test - - - org.apache.sling - org.apache.sling.testing.osgi-mock.junit4 - 3.5.2 - test - - - org.mockito - mockito-core - 4.4.0 - test - - - org.hamcrest - hamcrest-junit - 2.0.0.0 - test - - - org.slf4j - slf4j-simple - test - - - org.apache.sling - org.apache.sling.servlet-helpers - 2.0.0 - test - - - - org.apache.commons - commons-collections4 - 4.1 - test - - - - org.springframework - spring-context - 5.3.39 - test - - - javax.annotation - javax.annotation-api - 1.3.2 - provided - - - - - - org.apache.maven.plugins - maven-shade-plugin - - - - shade - - package - - true - true - - - org.apache.sling:org.apache.sling.scripting.core - - - - - org.apache.sling.scripting.core.impl.helper - slingmodelsimpl.org.apache.sling.scripting.core.impl.helper - - - - - org.apache.sling:org.apache.sling.scripting.core - - org/apache/sling/scripting/core/impl/helper/ProtectedBindings* - - - - - - - - - org.apache.rat - apache-rat-plugin - - - dependency-reduced-pom.xml - - - - - org.apache.maven.plugins - maven-source-plugin - - false - - - - + + parent + impl + From cf02ee6473e14758b4b25cd5cf8c61d9db767dfd Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Fri, 9 Jan 2026 15:37:54 +0100 Subject: [PATCH 02/16] add integration tests from https://github.com/apache/sling-org-apache-sling-models-integration-tests --- impl/pom.xml | 6 +- it/bnd.bnd | 7 + it/pom.xml | 244 +++++++++ .../delegate/request/DelegateBaseModel.java | 50 ++ .../request/DelegateExtendedModel.java | 46 ++ .../delegate/request/DelegateInterface.java | 26 + .../it/delegate/request/package-info.java | 21 + .../delegate/resource/DelegateBaseModel.java | 44 ++ .../resource/DelegateExtendedModel.java | 43 ++ .../delegate/resource/DelegateInterface.java | 26 + .../it/delegate/resource/package-info.java | 21 + .../it/delegate/viaoriginalresource/A.java | 21 + .../it/delegate/viaoriginalresource/A1.java | 21 + .../it/delegate/viaoriginalresource/B.java | 21 + .../it/delegate/viaoriginalresource/B1.java | 21 + .../viaoriginalresource/models/A1Impl.java | 43 ++ .../viaoriginalresource/models/AImpl.java | 39 ++ .../viaoriginalresource/models/B1Impl.java | 40 ++ .../viaoriginalresource/models/BImpl.java | 31 ++ .../models/package-info.java | 21 + .../viaoriginalresource/package-info.java | 21 + .../models/it/exporter/BaseComponent.java | 59 +++ .../it/exporter/BaseRequestComponent.java | 101 ++++ .../sling/models/it/exporter/Component.java | 26 + .../models/it/exporter/ComponentImpl.java | 50 ++ .../it/exporter/DoubledFirstComponent.java | 34 ++ .../it/exporter/DoubledSecondComponent.java | 34 ++ .../models/it/exporter/ExtendedComponent.java | 53 ++ .../it/exporter/ExtendedRequestComponent.java | 59 +++ .../it/exporter/RequestComponentImpl.java | 59 +++ .../models/it/exporter/package-info.java | 21 + .../CustomLastImplementationPicker.java | 44 ++ .../models/it/implpicker/package-info.java | 21 + .../models/ConstructorInjectionTestModel.java | 59 +++ .../it/models/FieldInjectionTestModel.java | 66 +++ .../models/InterfaceInjectionTestModel.java | 41 ++ .../it/models/ModelWithOptionalImport.java | 32 ++ .../models/it/models/RequestSelfModel.java | 26 + .../it/models/RequestSelfModelImpl.java | 34 ++ .../sling/models/it/models/SelfModel.java | 34 ++ .../it/models/ServiceInjectionTestModel.java | 49 ++ .../SlingPropertyAnnotationTestModel.java | 34 ++ .../sling/models/it/models/SourceObject.java | 34 ++ .../sling/models/it/models/ViaModel.java | 36 ++ .../implextend/ExtendsClassPropertyModel.java | 37 ++ .../ImplementsInterfacePropertyModel.java | 53 ++ .../ImplementsInterfacePropertyModel2.java | 52 ++ ...validImplementsInterfacePropertyModel.java | 52 ++ .../InvalidSampleServiceInterface.java | 30 ++ .../implextend/SampleServiceInterface.java | 30 ++ .../implextend/SimplePropertyModel.java | 47 ++ .../it/models/implextend/package-info.java | 21 + .../sling/models/it/models/package-info.java | 21 + .../models/it/rtbound/BaseComponent.java | 51 ++ .../models/it/rtbound/ExtendedComponent.java | 48 ++ .../it/rtbound/FromRequestComponent.java | 27 + .../sling/models/it/rtbound/package-info.java | 21 + .../it/rtboundpicker/BaseComponent.java | 31 ++ .../it/rtboundpicker/SubRTComponent.java | 31 ++ .../it/rtboundpicker/TestComponent.java | 24 + .../models/it/rtboundpicker/package-info.java | 21 + .../AnotherTestBindingsValuesProvider.java | 36 ++ .../models/it/services/SimpleService.java | 23 + .../SimpleServiceWithCustomRanking.java | 32 ++ .../services/TestBindingsValuesProvider.java | 36 ++ .../it/services/TestResourceDecorator.java | 66 +++ .../models/it/services/package-info.java | 21 + .../models/it/servlets/PathBoundServlet.java | 46 ++ .../apache/sling/models/it/noclasses/foo.txt | 1 + .../customizers/SM_TeleporterCustomizer.java | 61 +++ .../sling/models/testing/DecoratedIT.java | 96 ++++ .../models/testing/ImplementsExtendsIT.java | 150 ++++++ .../testing/InjectorSpecificAnnotationIT.java | 72 +++ .../models/testing/ModelFactorySimpleIT.java | 130 +++++ .../models/testing/PathBoundServletIT.java | 56 ++ ...erviceInjectionWithDifferentRankingIT.java | 147 ++++++ .../apache/sling/models/testing/SimpleIT.java | 111 ++++ .../apache/sling/models/testing/ViaIT.java | 77 +++ .../testing/delegate/DelegateRequestIT.java | 114 ++++ .../testing/delegate/DelegateResourceIT.java | 105 ++++ .../ViaOriginalResourceDelegationIT.java | 139 +++++ .../models/testing/exporter/ExporterIT.java | 344 ++++++++++++ .../models/testing/helper/FakeRequest.java | 400 ++++++++++++++ .../models/testing/helper/FakeResponse.java | 191 +++++++ .../models/testing/rtbound/FakeRequest.java | 498 ++++++++++++++++++ .../rtbound/ResourceTypeBindingIT.java | 146 +++++ .../rtboundpicker/ResourceTypePickerIT.java | 91 ++++ .../sling-models-jacksonexporter.txt | 24 + it/src/test/provisioning/sling.txt | 50 ++ pom.xml | 1 + 90 files changed, 5677 insertions(+), 3 deletions(-) create mode 100644 it/bnd.bnd create mode 100644 it/pom.xml create mode 100644 it/src/main/java/org/apache/sling/models/it/delegate/request/DelegateBaseModel.java create mode 100644 it/src/main/java/org/apache/sling/models/it/delegate/request/DelegateExtendedModel.java create mode 100644 it/src/main/java/org/apache/sling/models/it/delegate/request/DelegateInterface.java create mode 100644 it/src/main/java/org/apache/sling/models/it/delegate/request/package-info.java create mode 100644 it/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateBaseModel.java create mode 100644 it/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateExtendedModel.java create mode 100644 it/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateInterface.java create mode 100644 it/src/main/java/org/apache/sling/models/it/delegate/resource/package-info.java create mode 100644 it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/A.java create mode 100644 it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/A1.java create mode 100644 it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/B.java create mode 100644 it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/B1.java create mode 100644 it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/A1Impl.java create mode 100644 it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/AImpl.java create mode 100644 it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/B1Impl.java create mode 100644 it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/BImpl.java create mode 100644 it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/package-info.java create mode 100644 it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/package-info.java create mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/BaseComponent.java create mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/BaseRequestComponent.java create mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/Component.java create mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/ComponentImpl.java create mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/DoubledFirstComponent.java create mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/DoubledSecondComponent.java create mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/ExtendedComponent.java create mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/ExtendedRequestComponent.java create mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/RequestComponentImpl.java create mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/package-info.java create mode 100644 it/src/main/java/org/apache/sling/models/it/implpicker/CustomLastImplementationPicker.java create mode 100644 it/src/main/java/org/apache/sling/models/it/implpicker/package-info.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/ConstructorInjectionTestModel.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/FieldInjectionTestModel.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/InterfaceInjectionTestModel.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/ModelWithOptionalImport.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/RequestSelfModel.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/RequestSelfModelImpl.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/SelfModel.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/SlingPropertyAnnotationTestModel.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/SourceObject.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/ViaModel.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/implextend/ExtendsClassPropertyModel.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/implextend/ImplementsInterfacePropertyModel.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/implextend/ImplementsInterfacePropertyModel2.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/implextend/InvalidImplementsInterfacePropertyModel.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/implextend/InvalidSampleServiceInterface.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/implextend/SampleServiceInterface.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/implextend/SimplePropertyModel.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/implextend/package-info.java create mode 100644 it/src/main/java/org/apache/sling/models/it/models/package-info.java create mode 100644 it/src/main/java/org/apache/sling/models/it/rtbound/BaseComponent.java create mode 100644 it/src/main/java/org/apache/sling/models/it/rtbound/ExtendedComponent.java create mode 100644 it/src/main/java/org/apache/sling/models/it/rtbound/FromRequestComponent.java create mode 100644 it/src/main/java/org/apache/sling/models/it/rtbound/package-info.java create mode 100644 it/src/main/java/org/apache/sling/models/it/rtboundpicker/BaseComponent.java create mode 100644 it/src/main/java/org/apache/sling/models/it/rtboundpicker/SubRTComponent.java create mode 100644 it/src/main/java/org/apache/sling/models/it/rtboundpicker/TestComponent.java create mode 100644 it/src/main/java/org/apache/sling/models/it/rtboundpicker/package-info.java create mode 100644 it/src/main/java/org/apache/sling/models/it/services/AnotherTestBindingsValuesProvider.java create mode 100644 it/src/main/java/org/apache/sling/models/it/services/SimpleService.java create mode 100644 it/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java create mode 100644 it/src/main/java/org/apache/sling/models/it/services/TestBindingsValuesProvider.java create mode 100644 it/src/main/java/org/apache/sling/models/it/services/TestResourceDecorator.java create mode 100644 it/src/main/java/org/apache/sling/models/it/services/package-info.java create mode 100644 it/src/main/java/org/apache/sling/models/it/servlets/PathBoundServlet.java create mode 100644 it/src/main/resources/org/apache/sling/models/it/noclasses/foo.txt create mode 100644 it/src/test/java/org/apache/sling/junit/teleporter/customizers/SM_TeleporterCustomizer.java create mode 100644 it/src/test/java/org/apache/sling/models/testing/DecoratedIT.java create mode 100644 it/src/test/java/org/apache/sling/models/testing/ImplementsExtendsIT.java create mode 100644 it/src/test/java/org/apache/sling/models/testing/InjectorSpecificAnnotationIT.java create mode 100644 it/src/test/java/org/apache/sling/models/testing/ModelFactorySimpleIT.java create mode 100644 it/src/test/java/org/apache/sling/models/testing/PathBoundServletIT.java create mode 100644 it/src/test/java/org/apache/sling/models/testing/ServiceInjectionWithDifferentRankingIT.java create mode 100644 it/src/test/java/org/apache/sling/models/testing/SimpleIT.java create mode 100644 it/src/test/java/org/apache/sling/models/testing/ViaIT.java create mode 100644 it/src/test/java/org/apache/sling/models/testing/delegate/DelegateRequestIT.java create mode 100644 it/src/test/java/org/apache/sling/models/testing/delegate/DelegateResourceIT.java create mode 100644 it/src/test/java/org/apache/sling/models/testing/delegate/viaoriginalresource/ViaOriginalResourceDelegationIT.java create mode 100644 it/src/test/java/org/apache/sling/models/testing/exporter/ExporterIT.java create mode 100644 it/src/test/java/org/apache/sling/models/testing/helper/FakeRequest.java create mode 100644 it/src/test/java/org/apache/sling/models/testing/helper/FakeResponse.java create mode 100644 it/src/test/java/org/apache/sling/models/testing/rtbound/FakeRequest.java create mode 100644 it/src/test/java/org/apache/sling/models/testing/rtbound/ResourceTypeBindingIT.java create mode 100644 it/src/test/java/org/apache/sling/models/testing/rtboundpicker/ResourceTypePickerIT.java create mode 100644 it/src/test/provisioning/sling-models-jacksonexporter.txt create mode 100644 it/src/test/provisioning/sling.txt diff --git a/impl/pom.xml b/impl/pom.xml index 951d7d3f..a5b3f73d 100644 --- a/impl/pom.xml +++ b/impl/pom.xml @@ -22,9 +22,9 @@ org.apache.sling - sling-bundle-parent - 62 - + org.apache.sling.models.impl.parent + 2.0.1-SNAPSHOT + ../parent/pom.xml org.apache.sling.models.impl diff --git a/it/bnd.bnd b/it/bnd.bnd new file mode 100644 index 00000000..1aef1d37 --- /dev/null +++ b/it/bnd.bnd @@ -0,0 +1,7 @@ +Sling-Test-Regexp: .*Test + +Import-Package:\ + org.apache.commons.beanutils;resolution:=optional,\ + * + +-plugin: org.apache.sling.bnd.models.ModelsScannerPlugin diff --git a/it/pom.xml b/it/pom.xml new file mode 100644 index 00000000..7e209ec9 --- /dev/null +++ b/it/pom.xml @@ -0,0 +1,244 @@ + + + + 4.0.0 + + + org.apache.sling + org.apache.sling.models.impl.parent + 2.0.1-SNAPSHOT + ../parent/pom.xml + + + org.apache.sling.models.impl.it + + Apache Sling Models Implementation - Integration Tests + Apache Sling Models Integration Tests - builds a bundle + with Sling server-side tests, and executes them via a + remote test proxy that runs in the integration-tests phase. + + + 8 + + false + + + + + org.osgi + org.osgi.framework + provided + + + org.osgi + org.osgi.service.component + provided + + + + + org.osgi + org.osgi.annotation.versioning + provided + + + org.osgi + org.osgi.service.component.annotations + provided + + + org.osgi + org.osgi.service.metatype.annotations + provided + + + org.apache.sling + org.apache.sling.servlets.annotations + provided + + + + + org.apache.sling + org.apache.sling.junit.core + 1.0.28 + provided + + + org.apache.sling + org.apache.sling.testing.rules + 1.0.8 + test + + + org.apache.sling + org.apache.sling.testing.clients + 2.0.12 + test + + + javax.servlet + servlet-api + + + + + org.apache.sling + org.apache.sling.junit.teleporter + 1.0.20 + test + + + org.apache.sling + org.apache.sling.engine + 2.6.14 + provided + + + org.apache.sling + org.apache.sling.models.api + 1.5.5-SNAPSHOT + provided + + + org.apache.sling + org.apache.sling.models.impl + 1.7.3-SNAPSHOT + provided + + + org.apache.sling + org.apache.sling.models.jacksonexporter + 1.1.5-SNAPSHOT + provided + + + + + javax.servlet + javax.servlet-api + provided + + + javax.jcr + jcr + provided + + + org.apache.sling + org.apache.sling.api + 2.18.4 + provided + + + org.apache.commons + commons-lang3 + 3.8.1 + provided + + + com.fasterxml.jackson.core + jackson-annotations + 2.9.7 + provided + + + org.apache.geronimo.specs + geronimo-atinject_1.0_spec + 1.0 + provided + + + org.slf4j + slf4j-api + provided + + + org.jetbrains + annotations + provided + + + org.slf4j + slf4j-simple + test + + + junit + junit + test + + + + commons-beanutils + commons-beanutils + 1.9.4 + provided + + + + + + + biz.aQute.bnd + bnd-maven-plugin + + + org.apache.sling + org.apache.sling.bnd.models + 1.0.0 + + + + + biz.aQute.bnd + bnd-baseline-maven-plugin + + true + + + + org.apache.rat + apache-rat-plugin + + + src/main/resources/org/apache/sling/models/it/noclasses/foo.txt + + + + + + + + + debug-remote-process + + -Xmx512m -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=38080,suspend=n + + + + debug-remote-process-suspend + + -Xmx512m -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=38080,suspend=y + + + + + diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/request/DelegateBaseModel.java b/it/src/main/java/org/apache/sling/models/it/delegate/request/DelegateBaseModel.java new file mode 100644 index 00000000..1e4369e1 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/delegate/request/DelegateBaseModel.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.delegate.request; + +import javax.inject.Inject; + +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.Via; + +@Model( + adaptables = SlingHttpServletRequest.class, + adapters = DelegateInterface.class, + resourceType = "sling/delegate/base") +public class DelegateBaseModel implements DelegateInterface { + + @Inject + @Via("resource") + private String text; + + @Inject + @Via("resource") + private String other; + + @Override + public String getText() { + return text; + } + + @Override + public String getOther() { + return other; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/request/DelegateExtendedModel.java b/it/src/main/java/org/apache/sling/models/it/delegate/request/DelegateExtendedModel.java new file mode 100644 index 00000000..c2a01a7a --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/delegate/request/DelegateExtendedModel.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.delegate.request; + +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.Via; +import org.apache.sling.models.annotations.injectorspecific.Self; +import org.apache.sling.models.annotations.via.ResourceSuperType; + +@Model( + adaptables = SlingHttpServletRequest.class, + adapters = DelegateInterface.class, + resourceType = "sling/delegate/extended") +public class DelegateExtendedModel implements DelegateInterface { + + @Self + @Via(type = ResourceSuperType.class) + private DelegateInterface delegate; + + @Override + public String getOther() { + return delegate.getOther(); + } + + @Override + public String getText() { + return delegate.getText().toUpperCase(); + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/request/DelegateInterface.java b/it/src/main/java/org/apache/sling/models/it/delegate/request/DelegateInterface.java new file mode 100644 index 00000000..9826052d --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/delegate/request/DelegateInterface.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.delegate.request; + +public interface DelegateInterface { + + String getText(); + + String getOther(); +} diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/request/package-info.java b/it/src/main/java/org/apache/sling/models/it/delegate/request/package-info.java new file mode 100644 index 00000000..3e7e7013 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/delegate/request/package-info.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Version("1.0") +package org.apache.sling.models.it.delegate.request; + +import org.osgi.annotation.versioning.Version; diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateBaseModel.java b/it/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateBaseModel.java new file mode 100644 index 00000000..0b2031be --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateBaseModel.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.delegate.resource; + +import javax.inject.Inject; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; + +@Model(adaptables = Resource.class, adapters = DelegateInterface.class, resourceType = "sling/delegate/base") +public class DelegateBaseModel implements DelegateInterface { + + @Inject + private String text; + + @Inject + private String other; + + @Override + public String getText() { + return text; + } + + @Override + public String getOther() { + return other; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateExtendedModel.java b/it/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateExtendedModel.java new file mode 100644 index 00000000..df901f5c --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateExtendedModel.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.delegate.resource; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.Via; +import org.apache.sling.models.annotations.injectorspecific.Self; +import org.apache.sling.models.annotations.via.ResourceSuperType; + +@Model(adaptables = Resource.class, adapters = DelegateInterface.class, resourceType = "sling/delegate/extended") +public class DelegateExtendedModel implements DelegateInterface { + + @Self + @Via(type = ResourceSuperType.class) + private DelegateInterface delegate; + + @Override + public String getOther() { + return delegate.getOther(); + } + + @Override + public String getText() { + return delegate.getText().toUpperCase(); + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateInterface.java b/it/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateInterface.java new file mode 100644 index 00000000..2b208e2e --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateInterface.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.delegate.resource; + +public interface DelegateInterface { + + String getText(); + + String getOther(); +} diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/resource/package-info.java b/it/src/main/java/org/apache/sling/models/it/delegate/resource/package-info.java new file mode 100644 index 00000000..a0f5c5bd --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/delegate/resource/package-info.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Version("1.0") +package org.apache.sling.models.it.delegate.resource; + +import org.osgi.annotation.versioning.Version; diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/A.java b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/A.java new file mode 100644 index 00000000..7581feaa --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/A.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.delegate.viaoriginalresource; + +public interface A {} diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/A1.java b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/A1.java new file mode 100644 index 00000000..6d3048b6 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/A1.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.delegate.viaoriginalresource; + +public interface A1 extends A {} diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/B.java b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/B.java new file mode 100644 index 00000000..8fbbdab4 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/B.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.delegate.viaoriginalresource; + +public interface B {} diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/B1.java b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/B1.java new file mode 100644 index 00000000..50fb27c8 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/B1.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.delegate.viaoriginalresource; + +public interface B1 extends B {} diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/A1Impl.java b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/A1Impl.java new file mode 100644 index 00000000..62e4b63b --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/A1Impl.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.delegate.viaoriginalresource.models; + +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.Via; +import org.apache.sling.models.annotations.injectorspecific.Self; +import org.apache.sling.models.annotations.via.ResourceSuperType; +import org.apache.sling.models.it.delegate.viaoriginalresource.A; +import org.apache.sling.models.it.delegate.viaoriginalresource.A1; +import org.apache.sling.models.it.delegate.viaoriginalresource.B1; + +@Model( + adaptables = {SlingHttpServletRequest.class, Resource.class}, + adapters = {A1.class, A.class}, + resourceType = "delegate/nestedrtbound/specific") +public class A1Impl implements A1 { + + @Self + @Via(type = ResourceSuperType.class) + public A delegate; + + @Self + public B1 other; +} diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/AImpl.java b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/AImpl.java new file mode 100644 index 00000000..9622bdbb --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/AImpl.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.delegate.viaoriginalresource.models; + +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.Via; +import org.apache.sling.models.annotations.injectorspecific.Self; +import org.apache.sling.models.annotations.via.OriginalResourceType; +import org.apache.sling.models.it.delegate.viaoriginalresource.A; +import org.apache.sling.models.it.delegate.viaoriginalresource.B; + +@Model( + adaptables = {SlingHttpServletRequest.class, Resource.class}, + adapters = {A.class}, + resourceType = "delegate/nestedrtbound/generic") +public class AImpl implements A { + + @Self + @Via(type = OriginalResourceType.class) + public B other; +} diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/B1Impl.java b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/B1Impl.java new file mode 100644 index 00000000..85e744f9 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/B1Impl.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.delegate.viaoriginalresource.models; + +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.Via; +import org.apache.sling.models.annotations.injectorspecific.Self; +import org.apache.sling.models.annotations.via.ResourceSuperType; +import org.apache.sling.models.it.delegate.viaoriginalresource.B; +import org.apache.sling.models.it.delegate.viaoriginalresource.B1; + +@Model( + adaptables = {SlingHttpServletRequest.class, Resource.class}, + adapters = {B1.class, B.class}, + resourceType = "delegate/nestedrtbound/specific", + cache = true) +public class B1Impl implements B1 { + + @Self + @Via(type = ResourceSuperType.class) + public B delegate; +} diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/BImpl.java b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/BImpl.java new file mode 100644 index 00000000..e3b8569e --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/BImpl.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.delegate.viaoriginalresource.models; + +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.it.delegate.viaoriginalresource.B; + +@Model( + adaptables = {SlingHttpServletRequest.class, Resource.class}, + adapters = {B.class}, + resourceType = "delegate/nestedrtbound/generic", + cache = true) +public class BImpl implements B {} diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/package-info.java b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/package-info.java new file mode 100644 index 00000000..88f82b02 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/package-info.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Version("1.0") +package org.apache.sling.models.it.delegate.viaoriginalresource.models; + +import org.osgi.annotation.versioning.Version; diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/package-info.java b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/package-info.java new file mode 100644 index 00000000..fa049a57 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/package-info.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Version("1.0") +package org.apache.sling.models.it.delegate.viaoriginalresource; + +import org.osgi.annotation.versioning.Version; diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/BaseComponent.java b/it/src/main/java/org/apache/sling/models/it/exporter/BaseComponent.java new file mode 100644 index 00000000..c772d96d --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/exporter/BaseComponent.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.exporter; + +import javax.inject.Inject; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Exporter; +import org.apache.sling.models.annotations.Model; + +@Model( + adaptables = {Resource.class}, + resourceType = "sling/exp/base") +@Exporter(name = "jackson", extensions = "json") +public class BaseComponent { + + private final Resource resource; + + @Inject + private String sampleValue; + + public BaseComponent(Resource resource) { + this.resource = resource; + } + + public String getId() { + return this.resource.getPath(); + } + + public String getSampleValue() { + return sampleValue; + } + + @JsonProperty(value = "UPPER") + public String getSampleValueToUpperCase() { + return sampleValue.toUpperCase(); + } + + public Resource getResource() { + return resource; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/BaseRequestComponent.java b/it/src/main/java/org/apache/sling/models/it/exporter/BaseRequestComponent.java new file mode 100644 index 00000000..6aa54055 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/exporter/BaseRequestComponent.java @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.exporter; + +import javax.inject.Inject; +import javax.servlet.ServletRequest; +import javax.servlet.http.HttpServletRequest; + +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Exporter; +import org.apache.sling.models.annotations.ExporterOption; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.Via; +import org.apache.sling.models.annotations.injectorspecific.SlingObject; + +@Model( + adaptables = {SlingHttpServletRequest.class}, + resourceType = "sling/exp-request/base") +@Exporter( + name = "jackson", + extensions = "json", + options = {@ExporterOption(name = "MapperFeature.SORT_PROPERTIES_ALPHABETICALLY", value = "true")}) +public class BaseRequestComponent { + + @Inject + @SlingObject + private Resource resource; + + @Inject + @Via("resource") + private String sampleValue; + + @Inject + private Map testBindingsObject; + + @Inject + private Map testBindingsObject2; + + private final SlingHttpServletRequest request; + + public BaseRequestComponent(SlingHttpServletRequest request) { + this.request = request; + } + + public String getId() { + return this.resource.getPath(); + } + + public String getSampleValue() { + return sampleValue; + } + + @JsonProperty(value = "UPPER") + public String getSampleValueToUpperCase() { + return sampleValue.toUpperCase(); + } + + public Resource getResource() { + return resource; + } + + public Map getTestBindingsObject() { + return testBindingsObject; + } + + public Map getTestBindingsObject2() { + return testBindingsObject2; + } + + public SlingHttpServletRequest getSlingHttpServletRequest() { + return request; + } + + public HttpServletRequest getHttpServletRequest() { + return request; + } + + public ServletRequest getServletRequest() { + return request; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/Component.java b/it/src/main/java/org/apache/sling/models/it/exporter/Component.java new file mode 100644 index 00000000..d90f5a2c --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/exporter/Component.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.exporter; + +public interface Component { + + String getId(); + + String getSampleValue(); +} diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/ComponentImpl.java b/it/src/main/java/org/apache/sling/models/it/exporter/ComponentImpl.java new file mode 100644 index 00000000..4d0deb9a --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/exporter/ComponentImpl.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.exporter; + +import javax.inject.Inject; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Exporter; +import org.apache.sling.models.annotations.Model; + +@Model( + adaptables = {Resource.class}, + adapters = Component.class, + resourceType = "sling/exp/interface") +@Exporter(name = "jackson", extensions = "json") +public class ComponentImpl implements Component { + + private final Resource resource; + + @Inject + private String sampleValue; + + public ComponentImpl(Resource resource) { + this.resource = resource; + } + + public String getId() { + return this.resource.getPath(); + } + + public String getSampleValue() { + return sampleValue; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/DoubledFirstComponent.java b/it/src/main/java/org/apache/sling/models/it/exporter/DoubledFirstComponent.java new file mode 100644 index 00000000..84b0289a --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/exporter/DoubledFirstComponent.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.exporter; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Exporter; +import org.apache.sling.models.annotations.Model; + +@Model( + adaptables = {Resource.class}, + resourceType = "sling/exp/doubled") +@Exporter(name = "jackson", extensions = "json", selector = "firstmodel") +public class DoubledFirstComponent { + + public String getValue() { + return "first"; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/DoubledSecondComponent.java b/it/src/main/java/org/apache/sling/models/it/exporter/DoubledSecondComponent.java new file mode 100644 index 00000000..bbc118cb --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/exporter/DoubledSecondComponent.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.exporter; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Exporter; +import org.apache.sling.models.annotations.Model; + +@Model( + adaptables = {Resource.class}, + resourceType = "sling/exp/doubled") +@Exporter(name = "jackson", extensions = "json", selector = "secondmodel") +public class DoubledSecondComponent { + + public String getValue() { + return "second"; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/ExtendedComponent.java b/it/src/main/java/org/apache/sling/models/it/exporter/ExtendedComponent.java new file mode 100644 index 00000000..ff0bd7f2 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/exporter/ExtendedComponent.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.exporter; + +import javax.inject.Inject; + +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Exporter; +import org.apache.sling.models.annotations.Model; + +@Model( + adaptables = {Resource.class}, + resourceType = "sling/exp/extended") +@Exporter(name = "jackson", extensions = "json") +public class ExtendedComponent extends BaseComponent { + + @Inject + private Date date; + + public ExtendedComponent(Resource resource) { + super(resource); + } + + public Calendar getDateByCalendar() { + Calendar cal = new GregorianCalendar(); + cal.setTime(date); + return cal; + } + + public Date getDate() { + return date; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/ExtendedRequestComponent.java b/it/src/main/java/org/apache/sling/models/it/exporter/ExtendedRequestComponent.java new file mode 100644 index 00000000..492486db --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/exporter/ExtendedRequestComponent.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.exporter; + +import javax.inject.Inject; + +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.models.annotations.Exporter; +import org.apache.sling.models.annotations.ExporterOption; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.Via; + +@Model( + adaptables = {SlingHttpServletRequest.class}, + resourceType = "sling/exp-request/extended") +@Exporter( + name = "jackson", + extensions = "json", + options = {@ExporterOption(name = "SerializationFeature.WRITE_DATES_AS_TIMESTAMPS", value = "false")}) +public class ExtendedRequestComponent extends BaseRequestComponent { + + @Inject + @Via("resource") + private Date date; + + public ExtendedRequestComponent(SlingHttpServletRequest request) { + super(request); + } + + public Calendar getDateByCalendar() { + Calendar cal = new GregorianCalendar(); + cal.setTime(date); + return cal; + } + + public Date getDate() { + return date; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/RequestComponentImpl.java b/it/src/main/java/org/apache/sling/models/it/exporter/RequestComponentImpl.java new file mode 100644 index 00000000..2ffe7e6c --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/exporter/RequestComponentImpl.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.exporter; + +import javax.inject.Inject; + +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Exporter; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.Via; +import org.apache.sling.models.annotations.injectorspecific.SlingObject; + +@Model( + adaptables = {SlingHttpServletRequest.class}, + adapters = Component.class, + resourceType = "sling/exp-request/interface") +@Exporter(name = "jackson", extensions = "json") +public class RequestComponentImpl implements Component { + + @Inject + @SlingObject + private Resource resource; + + @Inject + @Via("resource") + private String sampleValue; + + @SuppressWarnings("unused") + private final SlingHttpServletRequest request; + + public RequestComponentImpl(SlingHttpServletRequest request) { + this.request = request; + } + + public String getId() { + return this.resource.getPath(); + } + + public String getSampleValue() { + return sampleValue; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/package-info.java b/it/src/main/java/org/apache/sling/models/it/exporter/package-info.java new file mode 100644 index 00000000..d6273ab4 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/exporter/package-info.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Version("1.0") +package org.apache.sling.models.it.exporter; + +import org.osgi.annotation.versioning.Version; diff --git a/it/src/main/java/org/apache/sling/models/it/implpicker/CustomLastImplementationPicker.java b/it/src/main/java/org/apache/sling/models/it/implpicker/CustomLastImplementationPicker.java new file mode 100644 index 00000000..59798477 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/implpicker/CustomLastImplementationPicker.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.implpicker; + +import org.apache.commons.lang3.StringUtils; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.spi.ImplementationPicker; +import org.jetbrains.annotations.NotNull; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.propertytypes.ServiceRanking; + +/** + * This is a curious {@link ImplementationPicker} implementation for integration test + * that picks the last implementation if the resource has the name "custom"; + */ +@Component(service = ImplementationPicker.class) +@ServiceRanking(100) +public class CustomLastImplementationPicker implements ImplementationPicker { + + public static final String CUSTOM_NAME = "custom"; + + public Class pick(@NotNull Class adapterType, Class[] implementationsTypes, @NotNull Object adaptable) { + if (adaptable instanceof Resource && StringUtils.equals(((Resource) adaptable).getName(), CUSTOM_NAME)) { + return implementationsTypes[implementationsTypes.length - 1]; + } + return null; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/implpicker/package-info.java b/it/src/main/java/org/apache/sling/models/it/implpicker/package-info.java new file mode 100644 index 00000000..c8a5b3e5 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/implpicker/package-info.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Version("1.0") +package org.apache.sling.models.it.implpicker; + +import org.osgi.annotation.versioning.Version; diff --git a/it/src/main/java/org/apache/sling/models/it/models/ConstructorInjectionTestModel.java b/it/src/main/java/org/apache/sling/models/it/models/ConstructorInjectionTestModel.java new file mode 100644 index 00000000..c80b1c59 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/ConstructorInjectionTestModel.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models; + +import javax.inject.Inject; +import javax.inject.Named; +import javax.servlet.Filter; + +import java.util.List; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.injectorspecific.Self; + +@Model(adaptables = Resource.class) +public class ConstructorInjectionTestModel { + + private final String testProperty; + private final List filters; + private final Resource resource; + + @Inject + public ConstructorInjectionTestModel( + @Named("testProperty") String testProperty, + @Named("filters") List filters, + @Self Resource resource) { + this.testProperty = testProperty; + this.filters = filters; + this.resource = resource; + } + + public String getTestProperty() { + return testProperty; + } + + public List getFilters() { + return filters; + } + + public Resource getResource() { + return resource; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/models/FieldInjectionTestModel.java b/it/src/main/java/org/apache/sling/models/it/models/FieldInjectionTestModel.java new file mode 100644 index 00000000..f8ed3a80 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/FieldInjectionTestModel.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models; + +import javax.inject.Inject; +import javax.inject.Named; +import javax.servlet.Filter; + +import java.util.List; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.Optional; + +@Model(adaptables = Resource.class) +public class FieldInjectionTestModel { + + @Inject + private String testProperty; + + @Inject + @Optional + @Named("child/childProperty") + private String childProperty; + + @Inject + private List filters; + + private final Resource resource; + + public FieldInjectionTestModel(Resource pResource) { + this.resource = pResource; + } + + public String getTestProperty() { + return testProperty; + } + + public String getChildProperty() { + return childProperty; + } + + public List getFilters() { + return filters; + } + + public Resource getResource() { + return resource; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/models/InterfaceInjectionTestModel.java b/it/src/main/java/org/apache/sling/models/it/models/InterfaceInjectionTestModel.java new file mode 100644 index 00000000..52e2e403 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/InterfaceInjectionTestModel.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models; + +import javax.inject.Inject; +import javax.servlet.Filter; + +import java.util.List; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.injectorspecific.Self; + +@Model(adaptables = Resource.class) +public interface InterfaceInjectionTestModel { + + @Inject + String getTestProperty(); + + @Inject + List getFilters(); + + @Self + Resource getResource(); +} diff --git a/it/src/main/java/org/apache/sling/models/it/models/ModelWithOptionalImport.java b/it/src/main/java/org/apache/sling/models/it/models/ModelWithOptionalImport.java new file mode 100644 index 00000000..d33b05b4 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/ModelWithOptionalImport.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models; + +import org.apache.commons.beanutils.BeanUtils; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; + +@Model(adaptables = Resource.class) +public class ModelWithOptionalImport { + + // this class is not available at runtime. The containing package has an optional import so the bundle + // still resolves + @SuppressWarnings("unused") + private BeanUtils beanUtils = new BeanUtils(); +} diff --git a/it/src/main/java/org/apache/sling/models/it/models/RequestSelfModel.java b/it/src/main/java/org/apache/sling/models/it/models/RequestSelfModel.java new file mode 100644 index 00000000..b711431b --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/RequestSelfModel.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models; + +import org.apache.sling.api.SlingHttpServletRequest; + +public interface RequestSelfModel { + + SlingHttpServletRequest getRequest(); +} diff --git a/it/src/main/java/org/apache/sling/models/it/models/RequestSelfModelImpl.java b/it/src/main/java/org/apache/sling/models/it/models/RequestSelfModelImpl.java new file mode 100644 index 00000000..de9e83fb --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/RequestSelfModelImpl.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models; + +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.injectorspecific.Self; + +@Model(adaptables = SlingHttpServletRequest.class, adapters = RequestSelfModel.class) +public class RequestSelfModelImpl implements RequestSelfModel { + + @Self + private SlingHttpServletRequest request; + + public SlingHttpServletRequest getRequest() { + return request; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/models/SelfModel.java b/it/src/main/java/org/apache/sling/models/it/models/SelfModel.java new file mode 100644 index 00000000..c635c4e1 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/SelfModel.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.injectorspecific.Self; + +@Model(adaptables = Resource.class) +public class SelfModel { + + @Self + private Resource resource; + + public Resource getResource() { + return resource; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java b/it/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java new file mode 100644 index 00000000..c9f2cf32 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.injectorspecific.OSGiService; +import org.apache.sling.models.it.services.SimpleService; + +@Model(adaptables = Resource.class) +public class ServiceInjectionTestModel { + + @OSGiService + private SimpleService simpleService; // must return the service impl with the highest ranking + + @OSGiService + private List simpleServices; + + public SimpleService getSimpleService() { + return simpleService; + } + + public Integer[] getSimpleServicesRankings() { + List serviceRankings = new ArrayList(); + for (SimpleService service : simpleServices) { + serviceRankings.add(service.getRanking()); + } + return serviceRankings.toArray(new Integer[serviceRankings.size()]); + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/models/SlingPropertyAnnotationTestModel.java b/it/src/main/java/org/apache/sling/models/it/models/SlingPropertyAnnotationTestModel.java new file mode 100644 index 00000000..abda77ac --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/SlingPropertyAnnotationTestModel.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.injectorspecific.ValueMapValue; + +@Model(adaptables = Resource.class) +public class SlingPropertyAnnotationTestModel { + + @ValueMapValue + private String testProperty; + + public String getTestProperty() { + return testProperty; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/models/SourceObject.java b/it/src/main/java/org/apache/sling/models/it/models/SourceObject.java new file mode 100644 index 00000000..d31d57f1 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/SourceObject.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models; + +import org.apache.sling.api.resource.Resource; + +public class SourceObject { + + public SourceObject(Resource resource) { + this.resource = resource; + } + + private Resource resource; + + public Resource getResource() { + return resource; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/models/ViaModel.java b/it/src/main/java/org/apache/sling/models/it/models/ViaModel.java new file mode 100644 index 00000000..a33c24e3 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/ViaModel.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models; + +import javax.inject.Inject; + +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.Via; + +@Model(adaptables = SourceObject.class) +public class ViaModel { + + @Inject + @Via("resource") + private String testProperty; + + public String getTestProperty() { + return testProperty; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/models/implextend/ExtendsClassPropertyModel.java b/it/src/main/java/org/apache/sling/models/it/models/implextend/ExtendsClassPropertyModel.java new file mode 100644 index 00000000..4dbb0dc1 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/implextend/ExtendsClassPropertyModel.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models.implextend; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; + +/** + * This is an example for a model that can not be adapted itself, but only + * to a superclass it extends. This superclass is defined as "adapters". + */ +@Model( + adaptables = Resource.class, + adapters = {SimplePropertyModel.class}) +public class ExtendsClassPropertyModel extends SimplePropertyModel { + + @Override + public String getAllProperties() { + return "!" + super.getAllProperties() + "!"; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/models/implextend/ImplementsInterfacePropertyModel.java b/it/src/main/java/org/apache/sling/models/it/models/implextend/ImplementsInterfacePropertyModel.java new file mode 100644 index 00000000..033d184e --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/implextend/ImplementsInterfacePropertyModel.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models.implextend; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.Optional; + +/** + * This is an example for a model that can not be adapted itself, but only + * to an interface it implements. This interfaces is defined as "adapters". + */ +@Model( + adaptables = Resource.class, + adapters = {SampleServiceInterface.class}) +public class ImplementsInterfacePropertyModel implements SampleServiceInterface { + + @Inject + private String first; + + @Inject + @Optional + private String second; + + @Inject + @Named("third") + private String thirdProperty; + + public String getAllProperties() { + StringBuilder sb = new StringBuilder(); + sb.append(first).append("|").append(second).append("|").append(thirdProperty); + return sb.toString(); + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/models/implextend/ImplementsInterfacePropertyModel2.java b/it/src/main/java/org/apache/sling/models/it/models/implextend/ImplementsInterfacePropertyModel2.java new file mode 100644 index 00000000..40d05ec4 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/implextend/ImplementsInterfacePropertyModel2.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models.implextend; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.Optional; + +/** + * Additional model class that implements the same interface as {@link ImplementsInterfacePropertyModel}. + */ +@Model( + adaptables = Resource.class, + adapters = {SampleServiceInterface.class}) +public class ImplementsInterfacePropertyModel2 implements SampleServiceInterface { + + @Inject + private String first; + + @Inject + @Optional + private String second; + + @Inject + @Named("third") + private String thirdProperty; + + public String getAllProperties() { + StringBuilder sb = new StringBuilder(); + sb.append(first).append("|").append(second).append("|").append(thirdProperty); + return sb.toString(); + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/models/implextend/InvalidImplementsInterfacePropertyModel.java b/it/src/main/java/org/apache/sling/models/it/models/implextend/InvalidImplementsInterfacePropertyModel.java new file mode 100644 index 00000000..6f0dfdf5 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/implextend/InvalidImplementsInterfacePropertyModel.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models.implextend; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.Optional; + +/** + * This model defines an invalid adapters property containing an interface it does not implement. + */ +@Model( + adaptables = Resource.class, + adapters = {InvalidSampleServiceInterface.class}) +public class InvalidImplementsInterfacePropertyModel implements SampleServiceInterface { + + @Inject + private String first; + + @Inject + @Optional + private String second; + + @Inject + @Named("third") + private String thirdProperty; + + public String getAllProperties() { + StringBuilder sb = new StringBuilder(); + sb.append(first).append("|").append(second).append("|").append(thirdProperty); + return sb.toString(); + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/models/implextend/InvalidSampleServiceInterface.java b/it/src/main/java/org/apache/sling/models/it/models/implextend/InvalidSampleServiceInterface.java new file mode 100644 index 00000000..18f26cbc --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/implextend/InvalidSampleServiceInterface.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models.implextend; + +/** + * Example "service" interface to which sling models can adapt. + */ +public interface InvalidSampleServiceInterface { + + /** + * @return concanated string with all properties + */ + String getAllProperties(); +} diff --git a/it/src/main/java/org/apache/sling/models/it/models/implextend/SampleServiceInterface.java b/it/src/main/java/org/apache/sling/models/it/models/implextend/SampleServiceInterface.java new file mode 100644 index 00000000..84f1155e --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/implextend/SampleServiceInterface.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models.implextend; + +/** + * Example "service" interface to which sling models can adapt. + */ +public interface SampleServiceInterface { + + /** + * @return concatenated string with all properties + */ + String getAllProperties(); +} diff --git a/it/src/main/java/org/apache/sling/models/it/models/implextend/SimplePropertyModel.java b/it/src/main/java/org/apache/sling/models/it/models/implextend/SimplePropertyModel.java new file mode 100644 index 00000000..a942c083 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/implextend/SimplePropertyModel.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models.implextend; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.apache.sling.models.annotations.Optional; + +/** + * Base class without @Model annotation. + */ +public class SimplePropertyModel { + + @Inject + private String first; + + @Inject + @Optional + private String second; + + @Inject + @Named("third") + private String thirdProperty; + + public String getAllProperties() { + StringBuilder sb = new StringBuilder(); + sb.append(first).append("|").append(second).append("|").append(thirdProperty); + return sb.toString(); + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/models/implextend/package-info.java b/it/src/main/java/org/apache/sling/models/it/models/implextend/package-info.java new file mode 100644 index 00000000..3d4840c2 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/implextend/package-info.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Version("1.0") +package org.apache.sling.models.it.models.implextend; + +import org.osgi.annotation.versioning.Version; diff --git a/it/src/main/java/org/apache/sling/models/it/models/package-info.java b/it/src/main/java/org/apache/sling/models/it/models/package-info.java new file mode 100644 index 00000000..d387b59b --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/models/package-info.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Version("1.0") +package org.apache.sling.models.it.models; + +import org.osgi.annotation.versioning.Version; diff --git a/it/src/main/java/org/apache/sling/models/it/rtbound/BaseComponent.java b/it/src/main/java/org/apache/sling/models/it/rtbound/BaseComponent.java new file mode 100644 index 00000000..b15f9f39 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/rtbound/BaseComponent.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.rtbound; + +import javax.inject.Inject; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; + +@Model( + adaptables = {Resource.class}, + resourceType = "sling/rt/base") +public class BaseComponent { + + private final Resource resource; + + @Inject + private String sampleValue; + + public BaseComponent(Resource resource) { + this.resource = resource; + } + + public String getId() { + return this.resource.getPath(); + } + + public String getSampleValue() { + return sampleValue; + } + + public String getSampleValueToUpperCase() { + return sampleValue.toUpperCase(); + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/rtbound/ExtendedComponent.java b/it/src/main/java/org/apache/sling/models/it/rtbound/ExtendedComponent.java new file mode 100644 index 00000000..43cbed78 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/rtbound/ExtendedComponent.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.rtbound; + +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; + +@Model( + adaptables = {Resource.class}, + resourceType = "sling/rt/extended") +public class ExtendedComponent extends BaseComponent { + + private final Date d = new Date(); + + public ExtendedComponent(Resource resource) { + super(resource); + } + + public Calendar getDateByCalendar() { + Calendar cal = new GregorianCalendar(); + cal.setTime(d); + return cal; + } + + public Date getDate() { + return d; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/rtbound/FromRequestComponent.java b/it/src/main/java/org/apache/sling/models/it/rtbound/FromRequestComponent.java new file mode 100644 index 00000000..c39b7548 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/rtbound/FromRequestComponent.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.rtbound; + +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.models.annotations.Model; + +@Model( + adaptables = {SlingHttpServletRequest.class}, + resourceType = "sling/rt/fromRequest") +public class FromRequestComponent {} diff --git a/it/src/main/java/org/apache/sling/models/it/rtbound/package-info.java b/it/src/main/java/org/apache/sling/models/it/rtbound/package-info.java new file mode 100644 index 00000000..19332e31 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/rtbound/package-info.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Version("1.0") +package org.apache.sling.models.it.rtbound; + +import org.osgi.annotation.versioning.Version; diff --git a/it/src/main/java/org/apache/sling/models/it/rtboundpicker/BaseComponent.java b/it/src/main/java/org/apache/sling/models/it/rtboundpicker/BaseComponent.java new file mode 100644 index 00000000..292cef06 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/rtboundpicker/BaseComponent.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.rtboundpicker; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; + +@Model(adaptables = Resource.class, adapters = TestComponent.class, resourceType = "sling/rtpicker/base") +public class BaseComponent implements TestComponent { + + @Override + public String getSampleValue() { + return "base"; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/rtboundpicker/SubRTComponent.java b/it/src/main/java/org/apache/sling/models/it/rtboundpicker/SubRTComponent.java new file mode 100644 index 00000000..32011b2b --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/rtboundpicker/SubRTComponent.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.rtboundpicker; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; + +@Model(adaptables = Resource.class, adapters = TestComponent.class, resourceType = "sling/rtpicker/sub") +public class SubRTComponent implements TestComponent { + + @Override + public String getSampleValue() { + return "sub"; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/rtboundpicker/TestComponent.java b/it/src/main/java/org/apache/sling/models/it/rtboundpicker/TestComponent.java new file mode 100644 index 00000000..3d97aea2 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/rtboundpicker/TestComponent.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.rtboundpicker; + +public interface TestComponent { + + String getSampleValue(); +} diff --git a/it/src/main/java/org/apache/sling/models/it/rtboundpicker/package-info.java b/it/src/main/java/org/apache/sling/models/it/rtboundpicker/package-info.java new file mode 100644 index 00000000..950815c2 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/rtboundpicker/package-info.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Version("1.0") +package org.apache.sling.models.it.rtboundpicker; + +import org.osgi.annotation.versioning.Version; diff --git a/it/src/main/java/org/apache/sling/models/it/services/AnotherTestBindingsValuesProvider.java b/it/src/main/java/org/apache/sling/models/it/services/AnotherTestBindingsValuesProvider.java new file mode 100644 index 00000000..9dcce319 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/services/AnotherTestBindingsValuesProvider.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.services; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.osgi.service.component.annotations.Component; + +@Component( + service = Map.class, + property = {"javax.script.name=sling-models-exporter"}) +public class AnotherTestBindingsValuesProvider extends HashMap { + private static final long serialVersionUID = 1L; + + public AnotherTestBindingsValuesProvider() { + super.put("testBindingsObject2", Collections.singletonMap("name2", "value2")); + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/services/SimpleService.java b/it/src/main/java/org/apache/sling/models/it/services/SimpleService.java new file mode 100644 index 00000000..aeb4ee15 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/services/SimpleService.java @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.services; + +public interface SimpleService { + int getRanking(); +} diff --git a/it/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java b/it/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java new file mode 100644 index 00000000..33a8068d --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.services; + +public class SimpleServiceWithCustomRanking implements SimpleService { + + private final int ranking; + + public SimpleServiceWithCustomRanking(int ranking) { + this.ranking = ranking; + } + + public int getRanking() { + return ranking; + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/services/TestBindingsValuesProvider.java b/it/src/main/java/org/apache/sling/models/it/services/TestBindingsValuesProvider.java new file mode 100644 index 00000000..a7dcb68d --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/services/TestBindingsValuesProvider.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.services; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.osgi.service.component.annotations.Component; + +@Component( + service = Map.class, + property = {"javax.script.name=*"}) +public class TestBindingsValuesProvider extends HashMap { + private static final long serialVersionUID = -5029445376678233701L; + + public TestBindingsValuesProvider() { + super.put("testBindingsObject", Collections.singletonMap("name", "value")); + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/services/TestResourceDecorator.java b/it/src/main/java/org/apache/sling/models/it/services/TestResourceDecorator.java new file mode 100644 index 00000000..8d2a0a1c --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/services/TestResourceDecorator.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.services; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.sling.api.adapter.AdapterManager; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceDecorator; +import org.apache.sling.api.resource.ResourceWrapper; +import org.apache.sling.api.resource.ValueMap; +import org.jetbrains.annotations.NotNull; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +@Component(service = ResourceDecorator.class) +public class TestResourceDecorator implements ResourceDecorator { + + @Reference + private AdapterManager adapterManager; + + @Override + @SuppressWarnings("null") + public Resource decorate(@NotNull Resource resource) { + ValueMap map = resource.adaptTo(ValueMap.class); + if (map != null && map.containsKey("decorate")) { + if (map.get("decorate", "default").equals("customAdaptTo")) { + return new ResourceWrapper(resource) { + @Override + public AdapterType adaptTo(Class type) { + AdapterType adapter = adapterManager.getAdapter(this, type); + if (adapter != null) { + return adapter; + } else { + return super.adaptTo(type); + } + } + }; + } else { + return new ResourceWrapper(resource); + } + } + return null; + } + + @Override + public Resource decorate(@NotNull Resource resource, @NotNull HttpServletRequest request) { + return decorate(resource); + } +} diff --git a/it/src/main/java/org/apache/sling/models/it/services/package-info.java b/it/src/main/java/org/apache/sling/models/it/services/package-info.java new file mode 100644 index 00000000..1f5740a8 --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/services/package-info.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Version("1.0") +package org.apache.sling.models.it.services; + +import org.osgi.annotation.versioning.Version; diff --git a/it/src/main/java/org/apache/sling/models/it/servlets/PathBoundServlet.java b/it/src/main/java/org/apache/sling/models/it/servlets/PathBoundServlet.java new file mode 100644 index 00000000..7657275a --- /dev/null +++ b/it/src/main/java/org/apache/sling/models/it/servlets/PathBoundServlet.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.servlets; + +import javax.servlet.Servlet; +import javax.servlet.ServletException; + +import java.io.IOException; + +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.api.SlingHttpServletResponse; +import org.apache.sling.api.servlets.SlingSafeMethodsServlet; +import org.apache.sling.models.it.models.RequestSelfModel; +import org.apache.sling.servlets.annotations.SlingServletPaths; +import org.jetbrains.annotations.NotNull; +import org.osgi.service.component.annotations.Component; + +@Component(service = Servlet.class) +@SlingServletPaths("/apps/rtpickerrequest") +public class PathBoundServlet extends SlingSafeMethodsServlet { + private static final long serialVersionUID = 1L; + + @Override + @SuppressWarnings("unused") + protected void doGet(@NotNull SlingHttpServletRequest request, @NotNull SlingHttpServletResponse response) + throws ServletException, IOException { + RequestSelfModel model = request.adaptTo(RequestSelfModel.class); + response.setStatus(200); + } +} diff --git a/it/src/main/resources/org/apache/sling/models/it/noclasses/foo.txt b/it/src/main/resources/org/apache/sling/models/it/noclasses/foo.txt new file mode 100644 index 00000000..dd50685b --- /dev/null +++ b/it/src/main/resources/org/apache/sling/models/it/noclasses/foo.txt @@ -0,0 +1 @@ +text file to ensure the package gets created, but without class files \ No newline at end of file diff --git a/it/src/test/java/org/apache/sling/junit/teleporter/customizers/SM_TeleporterCustomizer.java b/it/src/test/java/org/apache/sling/junit/teleporter/customizers/SM_TeleporterCustomizer.java new file mode 100644 index 00000000..22efc011 --- /dev/null +++ b/it/src/test/java/org/apache/sling/junit/teleporter/customizers/SM_TeleporterCustomizer.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.junit.teleporter.customizers; + +import java.net.URI; +import java.util.concurrent.TimeoutException; + +import org.apache.sling.junit.rules.TeleporterRule; +import org.apache.sling.models.impl.ModelAdapterFactory; +import org.apache.sling.models.jacksonexporter.impl.JacksonExporter; +import org.apache.sling.testing.clients.ClientException; +import org.apache.sling.testing.clients.osgi.OsgiConsoleClient; +import org.apache.sling.testing.serversetup.instance.SlingTestBase; +import org.apache.sling.testing.teleporter.client.ClientSideTeleporter; +import org.apache.sling.testing.timeouts.TimeoutsProvider; + +/** This is required by the TeleporterRule, to setup the client-side + * teleporter with (at least) the test server URL. + */ +public class SM_TeleporterCustomizer implements TeleporterRule.Customizer { + + private static final SlingTestBase S = new SlingTestBase(); + + private static final Class[] EXPECTED_COMPONENTS = new Class[] {ModelAdapterFactory.class, JacksonExporter.class}; + + @Override + public void customize(TeleporterRule t, String options) { + final ClientSideTeleporter cst = (ClientSideTeleporter) t; + cst.setBaseUrl(S.getServerBaseUrl()); + cst.setServerCredentials(S.getServerUsername(), S.getServerPassword()); + cst.setTestReadyTimeoutSeconds(TimeoutsProvider.getInstance().getTimeout(5)); + cst.includeDependencyPrefix("org.apache.sling.models.testing"); + + // additionally check for the registration of mandatory sling models components + try { + OsgiConsoleClient osgiClient = new OsgiConsoleClient( + URI.create(S.getServerBaseUrl()), S.getServerUsername(), S.getServerPassword()); + for (Class clazz : EXPECTED_COMPONENTS) { + osgiClient.waitComponentRegistered(clazz.getName(), 20000, 200); + } + } catch (ClientException | TimeoutException | InterruptedException ex) { + throw new RuntimeException("Error waiting for expected components.", ex); + } + } +} diff --git a/it/src/test/java/org/apache/sling/models/testing/DecoratedIT.java b/it/src/test/java/org/apache/sling/models/testing/DecoratedIT.java new file mode 100644 index 00000000..8c0a39b1 --- /dev/null +++ b/it/src/test/java/org/apache/sling/models/testing/DecoratedIT.java @@ -0,0 +1,96 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.testing; + +import javax.jcr.Node; +import javax.jcr.Session; + +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.ResourceWrapper; +import org.apache.sling.junit.rules.TeleporterRule; +import org.apache.sling.models.factory.ModelFactory; +import org.apache.sling.models.it.models.SelfModel; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +public class DecoratedIT { + + @Rule + public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "SM_Teleporter"); + + private ModelFactory modelFactory; + + private ResourceResolver resolver; + private Resource resourceWithDefaultWrapperBehavior; + private Resource resourceWithCustomAdaptToWrapper; + + @Before + @SuppressWarnings("null") + public void setUp() throws Exception { + ResourceResolverFactory rrFactory = teleporter.getService(ResourceResolverFactory.class); + modelFactory = teleporter.getService(ModelFactory.class); + resolver = rrFactory.getServiceResourceResolver(null); + Session session = resolver.adaptTo(Session.class); + Node rootNode = session.getRootNode(); + Node createdNode = rootNode.addNode("test_" + RandomStringUtils.randomAlphanumeric(10)); + createdNode.setProperty("decorate", true); + session.save(); + + resourceWithDefaultWrapperBehavior = resolver.getResource(createdNode.getPath()); + + createdNode = rootNode.addNode("test_" + RandomStringUtils.randomAlphanumeric(10)); + createdNode.setProperty("decorate", "customAdaptTo"); + session.save(); + + resourceWithCustomAdaptToWrapper = resolver.getResource(createdNode.getPath()); + } + + @After + public void tearDown() throws Exception { + resolver.delete(resourceWithDefaultWrapperBehavior); + resolver.delete(resourceWithCustomAdaptToWrapper); + resolver.close(); + } + + @Test + public void testInjectDecoratedResourceUsingCreateModel() { + assertTrue("Resource is not wrapped", resourceWithDefaultWrapperBehavior instanceof ResourceWrapper); + SelfModel model = modelFactory.createModel(resourceWithDefaultWrapperBehavior, SelfModel.class); + + assertNotNull("Model is null", model); + assertTrue("Model is not wrapped", model.getResource() instanceof ResourceWrapper); + } + + @Test + public void testInjectDecoratedResourceUsingAdaptTo() { + assertTrue("Resource is not wrapped", resourceWithCustomAdaptToWrapper instanceof ResourceWrapper); + SelfModel model = resourceWithCustomAdaptToWrapper.adaptTo(SelfModel.class); + + assertNotNull("Model is null", model); + assertTrue("Model is not wrapped", model.getResource() instanceof ResourceWrapper); + } +} diff --git a/it/src/test/java/org/apache/sling/models/testing/ImplementsExtendsIT.java b/it/src/test/java/org/apache/sling/models/testing/ImplementsExtendsIT.java new file mode 100644 index 00000000..cc42661a --- /dev/null +++ b/it/src/test/java/org/apache/sling/models/testing/ImplementsExtendsIT.java @@ -0,0 +1,150 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.testing; + +import javax.jcr.Node; +import javax.jcr.RepositoryException; +import javax.jcr.Session; + +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.sling.api.adapter.AdapterManager; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.junit.rules.TeleporterRule; +import org.apache.sling.models.it.implpicker.CustomLastImplementationPicker; +import org.apache.sling.models.it.models.implextend.ImplementsInterfacePropertyModel; +import org.apache.sling.models.it.models.implextend.ImplementsInterfacePropertyModel2; +import org.apache.sling.models.it.models.implextend.InvalidSampleServiceInterface; +import org.apache.sling.models.it.models.implextend.SampleServiceInterface; +import org.apache.sling.models.it.models.implextend.SimplePropertyModel; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +public class ImplementsExtendsIT { + + @Rule + public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "SM_Teleporter"); + + private AdapterManager adapterManager; + + private String firstValue; + private String secondValue; + private String thirdValue; + private ResourceResolver resolver; + private Resource resource; + private Node createdNode; + + @Before + @SuppressWarnings("null") + public void setUp() throws Exception { + ResourceResolverFactory rrFactory = teleporter.getService(ResourceResolverFactory.class); + adapterManager = teleporter.getService(AdapterManager.class); + firstValue = RandomStringUtils.randomAlphanumeric(10); + thirdValue = RandomStringUtils.randomAlphanumeric(10); + + resolver = rrFactory.getServiceResourceResolver(null); + Session session = resolver.adaptTo(Session.class); + Node rootNode = session.getRootNode(); + createdNode = rootNode.addNode("test_" + RandomStringUtils.randomAlphanumeric(10)); + createdNode.setProperty("first", firstValue); + createdNode.setProperty("third", thirdValue); + session.save(); + + resource = resolver.getResource(createdNode.getPath()); + } + + @After + public void after() throws Exception { + if (resolver != null) { + resolver.close(); + } + } + + /** + * Try to adapt to interface, with an different implementation class that has the @Model annotation + */ + @Test + public void testImplementsInterfaceModel() { + SampleServiceInterface model = adapterManager.getAdapter(resource, SampleServiceInterface.class); + assertNotNull(model); + assertEquals(ImplementsInterfacePropertyModel.class, model.getClass()); + assertEquals(firstValue + "|" + secondValue + "|" + thirdValue, model.getAllProperties()); + } + + /** + * Ensure that the implementation class itself can be adapted to, even if it is not part of the "adapter" property in the annotation. + */ + @Test + public void testImplementsInterfaceModel_ImplClassImplicitlyMapped() { + ImplementsInterfacePropertyModel model = + adapterManager.getAdapter(resource, ImplementsInterfacePropertyModel.class); + assertNotNull(model); + } + + /** + * Test implementation class with a mapping that is not valid (an interface that is not implemented). + */ + @Test + public void testInvalidImplementsInterfaceModel() { + InvalidSampleServiceInterface model = adapterManager.getAdapter(resource, InvalidSampleServiceInterface.class); + assertNull(model); + } + + /** + * Test to adapt to a superclass of the implementation class with the appropriate mapping in the @Model annotation. + */ + @Test + public void testExtendsClassModel() { + SimplePropertyModel model = adapterManager.getAdapter(resource, SimplePropertyModel.class); + assertNotNull(model); + assertEquals("!" + firstValue + "|" + secondValue + "|" + thirdValue + "!", model.getAllProperties()); + } + + /** + * Try to adapt to interface, with an different implementation class that has the @Model annotation + */ + @Test + @SuppressWarnings("null") + public void testImplementsInterfaceModelWithPickLastImplementationPicker() throws RepositoryException { + + Session session = resolver.adaptTo(Session.class); + Node node = resource.adaptTo(Node.class); + Node childNode = node.addNode(CustomLastImplementationPicker.CUSTOM_NAME); + childNode.setProperty("first", firstValue); + childNode.setProperty("third", thirdValue); + session.save(); + + Resource childResource = resolver.getResource(childNode.getPath()); + + SampleServiceInterface model = adapterManager.getAdapter(childResource, SampleServiceInterface.class); + assertNotNull(model); + assertEquals(ImplementsInterfacePropertyModel2.class, model.getClass()); + assertEquals(firstValue + "|" + secondValue + "|" + thirdValue, model.getAllProperties()); + + childNode.remove(); + session.save(); + } +} diff --git a/it/src/test/java/org/apache/sling/models/testing/InjectorSpecificAnnotationIT.java b/it/src/test/java/org/apache/sling/models/testing/InjectorSpecificAnnotationIT.java new file mode 100644 index 00000000..3764dbc0 --- /dev/null +++ b/it/src/test/java/org/apache/sling/models/testing/InjectorSpecificAnnotationIT.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.testing; + +import javax.jcr.Node; +import javax.jcr.Session; + +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.junit.rules.TeleporterRule; +import org.apache.sling.models.it.models.SlingPropertyAnnotationTestModel; +import org.junit.Rule; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +public class InjectorSpecificAnnotationIT { + + @Rule + public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "SM_Teleporter"); + + @Test + @SuppressWarnings("null") + public void test() throws Exception { + ResourceResolverFactory rrFactory = teleporter.getService(ResourceResolverFactory.class); + String value = RandomStringUtils.randomAlphanumeric(10); + + ResourceResolver resolver = null; + Node createdNode = null; + try { + resolver = rrFactory.getServiceResourceResolver(null); + Session session = resolver.adaptTo(Session.class); + Node rootNode = session.getRootNode(); + createdNode = rootNode.addNode("test_" + RandomStringUtils.randomAlphanumeric(10)); + createdNode.setProperty("testProperty", value); + session.save(); + + Resource resource = resolver.getResource(createdNode.getPath()); + + SlingPropertyAnnotationTestModel model = resource.adaptTo(SlingPropertyAnnotationTestModel.class); + + assertNotNull("Model is null", model); + assertEquals("Test Property is not set correctly", value, model.getTestProperty()); + } finally { + if (createdNode != null) { + createdNode.remove(); + } + if (resolver != null) { + resolver.close(); + } + } + } +} diff --git a/it/src/test/java/org/apache/sling/models/testing/ModelFactorySimpleIT.java b/it/src/test/java/org/apache/sling/models/testing/ModelFactorySimpleIT.java new file mode 100644 index 00000000..54681137 --- /dev/null +++ b/it/src/test/java/org/apache/sling/models/testing/ModelFactorySimpleIT.java @@ -0,0 +1,130 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.testing; + +import javax.jcr.Node; +import javax.jcr.Session; + +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.junit.rules.TeleporterRule; +import org.apache.sling.models.factory.ModelFactory; +import org.apache.sling.models.it.models.ConstructorInjectionTestModel; +import org.apache.sling.models.it.models.FieldInjectionTestModel; +import org.apache.sling.models.it.models.implextend.InvalidImplementsInterfacePropertyModel; +import org.apache.sling.models.it.models.implextend.SampleServiceInterface; +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; + +public class ModelFactorySimpleIT { + + @Rule + public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "SM_Teleporter"); + + private ModelFactory modelFactory; + + private String value; + private ResourceResolver resolver; + private Resource resource; + private Node createdNode; + + @Before + @SuppressWarnings("null") + public void setUp() throws Exception { + ResourceResolverFactory rrFactory = teleporter.getService(ResourceResolverFactory.class); + modelFactory = teleporter.getService(ModelFactory.class); + value = RandomStringUtils.randomAlphanumeric(10); + + resolver = rrFactory.getServiceResourceResolver(null); + Session session = resolver.adaptTo(Session.class); + Node rootNode = session.getRootNode(); + createdNode = rootNode.addNode("test_" + RandomStringUtils.randomAlphanumeric(10)); + createdNode.setProperty("testProperty", value); + session.save(); + + resource = resolver.getResource(createdNode.getPath()); + } + + @After + public void tearDown() throws Exception { + if (createdNode != null) { + createdNode.remove(); + } + if (resolver != null) { + resolver.close(); + } + } + + @Test + public void testCreateModel() { + FieldInjectionTestModel model = modelFactory.createModel(resource, FieldInjectionTestModel.class); + + assertNotNull("Model is null", model); + assertEquals("Test Property is not set correctly", value, model.getTestProperty()); + assertNotNull("Filters is null", model.getFilters()); + assertSame("Adaptable is not injected", resource, model.getResource()); + } + + @Ignore + private static final class DummyClass {} + + @Test + public void testIsModelClass() { + assertTrue("Model is not detected as such", modelFactory.isModelClass(ConstructorInjectionTestModel.class)); + assertFalse("Dummy class incorrectly detected as model class", modelFactory.isModelClass(DummyClass.class)); + assertFalse( + "Model with invalid adaptable incorrectly detected as model class", + modelFactory.isModelClass(InvalidImplementsInterfacePropertyModel.class)); + assertTrue( + "Model is not detected as such", + modelFactory.isModelClass(SampleServiceInterface.class)); // being provided by two adapters + } + + @Test + public void testCanCreateFromAdaptable() { + assertTrue( + "Model is not detected as such", + modelFactory.canCreateFromAdaptable(resource, ConstructorInjectionTestModel.class)); + assertTrue( + "Model is not detected as such", + modelFactory.canCreateFromAdaptable(resource, SampleServiceInterface.class)); + assertFalse( + "Model is incorrectly detected", + modelFactory.canCreateFromAdaptable( + new String(), ConstructorInjectionTestModel.class)); // invalid adaptable + } + + @Test() + public void testCanCreateFromAdaptableWithModelExceptin() { + assertFalse( + "Model is incorrectly detected", + modelFactory.canCreateFromAdaptable(resource, DummyClass.class)); // no model class + } +} diff --git a/it/src/test/java/org/apache/sling/models/testing/PathBoundServletIT.java b/it/src/test/java/org/apache/sling/models/testing/PathBoundServletIT.java new file mode 100644 index 00000000..1bd4ad16 --- /dev/null +++ b/it/src/test/java/org/apache/sling/models/testing/PathBoundServletIT.java @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.testing; + +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.engine.SlingRequestProcessor; +import org.apache.sling.junit.rules.TeleporterRule; +import org.apache.sling.models.testing.helper.FakeRequest; +import org.apache.sling.models.testing.helper.FakeResponse; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +public class PathBoundServletIT { + + @Rule + public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "SM_Teleporter"); + + private ResourceResolverFactory rrFactory; + private SlingRequestProcessor slingRequestProcessor; + + @Before + @SuppressWarnings("null") + public void setup() { + rrFactory = teleporter.getService(ResourceResolverFactory.class); + slingRequestProcessor = teleporter.getService(SlingRequestProcessor.class); + } + + @Test + public void testDoubledServlets() throws Exception { + try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { + FakeResponse response = new FakeResponse(); + slingRequestProcessor.processRequest(new FakeRequest("/apps/rtpickerrequest"), response, resolver); + + Assert.assertEquals(200, response.getStatus()); + } + } +} diff --git a/it/src/test/java/org/apache/sling/models/testing/ServiceInjectionWithDifferentRankingIT.java b/it/src/test/java/org/apache/sling/models/testing/ServiceInjectionWithDifferentRankingIT.java new file mode 100644 index 00000000..7a9b1a08 --- /dev/null +++ b/it/src/test/java/org/apache/sling/models/testing/ServiceInjectionWithDifferentRankingIT.java @@ -0,0 +1,147 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.testing; + +import javax.jcr.Node; +import javax.jcr.Session; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Dictionary; +import java.util.Hashtable; + +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.junit.Activator; +import org.apache.sling.junit.rules.TeleporterRule; +import org.apache.sling.models.factory.ModelFactory; +import org.apache.sling.models.it.models.ServiceInjectionTestModel; +import org.apache.sling.models.it.services.SimpleService; +import org.apache.sling.models.it.services.SimpleServiceWithCustomRanking; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceRegistration; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +public class ServiceInjectionWithDifferentRankingIT { + + @Rule + public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "SM_Teleporter"); + + private ModelFactory modelFactory; + + private String value; + private ResourceResolver resolver; + private Resource resource; + private Node createdNode; + private BundleContext bundleContext; + private Collection serviceRegistrations; + + @Before + @SuppressWarnings("null") + public void setUp() throws Exception { + ResourceResolverFactory rrFactory = teleporter.getService(ResourceResolverFactory.class); + modelFactory = teleporter.getService(ModelFactory.class); + value = RandomStringUtils.randomAlphanumeric(10); + + resolver = rrFactory.getServiceResourceResolver(null); + Session session = resolver.adaptTo(Session.class); + Node rootNode = session.getRootNode(); + createdNode = rootNode.addNode("test_" + RandomStringUtils.randomAlphanumeric(10)); + createdNode.setProperty("testProperty", value); + session.save(); + + resource = resolver.getResource(createdNode.getPath()); + + bundleContext = Activator.getBundleContext(); + serviceRegistrations = new ArrayList(); + } + + @After + public void tearDown() throws Exception { + if (createdNode != null) { + createdNode.remove(); + } + if (resolver != null) { + resolver.close(); + } + + for (ServiceRegistration serviceRegistration : serviceRegistrations) { + serviceRegistration.unregister(); + } + } + + @SuppressWarnings("unchecked") + private void registerSimpleService(int ranking) { + @SuppressWarnings("rawtypes") + Dictionary serviceProps = new Hashtable(); + serviceProps.put(Constants.SERVICE_RANKING, new Integer(ranking)); + ServiceRegistration serviceRegistration = bundleContext.registerService( + SimpleService.class.getName(), new SimpleServiceWithCustomRanking(ranking), serviceProps); + serviceRegistrations.add(serviceRegistration); + } + + @Test + public void testServiceInjectionConsideringRankingWithResource() throws IOException { + + registerSimpleService(0); + // cannot use adaptTo due to adaptersCache + ServiceInjectionTestModel model = modelFactory.createModel(resource, ServiceInjectionTestModel.class); + assertNotNull("Model is null", model); + // only the default service with ranking 0 is known + assertEquals( + "The service with the highest ranking was not returned", + 0, + model.getSimpleService().getRanking()); + assertArrayEquals("Order on injected services is wrong", model.getSimpleServicesRankings(), new Integer[] {0}); + + registerSimpleService(-1000); + model = modelFactory.createModel(resource, ServiceInjectionTestModel.class); + assertNotNull("Model is null", model); + // ranking 0 is still the highest one + assertEquals( + "The service with the highest ranking was not returned", + 0, + model.getSimpleService().getRanking()); + assertArrayEquals( + "Order on injected services is wrong", model.getSimpleServicesRankings(), new Integer[] {0, -1000}); + + registerSimpleService(1000); + model = modelFactory.createModel(resource, ServiceInjectionTestModel.class); + assertNotNull("Model is null", model); + // now ranking 1000 is the highest + assertEquals( + "The service with the highest ranking was not returned", + 1000, + model.getSimpleService().getRanking()); + assertArrayEquals( + "Order on injected services is wrong", model.getSimpleServicesRankings(), new Integer[] {1000, 0, -1000 + }); + } +} diff --git a/it/src/test/java/org/apache/sling/models/testing/SimpleIT.java b/it/src/test/java/org/apache/sling/models/testing/SimpleIT.java new file mode 100644 index 00000000..7ab3c7f5 --- /dev/null +++ b/it/src/test/java/org/apache/sling/models/testing/SimpleIT.java @@ -0,0 +1,111 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.testing; + +import javax.jcr.Node; +import javax.jcr.Session; + +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.junit.rules.TeleporterRule; +import org.apache.sling.models.it.models.ConstructorInjectionTestModel; +import org.apache.sling.models.it.models.FieldInjectionTestModel; +import org.apache.sling.models.it.models.InterfaceInjectionTestModel; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; + +public class SimpleIT { + + @Rule + public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "SM_Teleporter"); + + private String value; + private String childValue; + private ResourceResolver resolver; + private Resource resource; + private Node createdNode; + + @Before + @SuppressWarnings("null") + public void setUp() throws Exception { + ResourceResolverFactory rrFactory = teleporter.getService(ResourceResolverFactory.class); + value = RandomStringUtils.randomAlphanumeric(10); + childValue = RandomStringUtils.randomAlphanumeric(10); + + resolver = rrFactory.getServiceResourceResolver(null); + Session session = resolver.adaptTo(Session.class); + Node rootNode = session.getRootNode(); + createdNode = rootNode.addNode("test_" + RandomStringUtils.randomAlphanumeric(10)); + createdNode.setProperty("testProperty", value); + Node child = createdNode.addNode("child"); + child.setProperty("childProperty", childValue); + session.save(); + + resource = resolver.getResource(createdNode.getPath()); + } + + @After + public void tearDown() throws Exception { + if (createdNode != null) { + createdNode.remove(); + } + if (resolver != null) { + resolver.close(); + } + } + + @Test + public void testFieldInjection() { + FieldInjectionTestModel model = resource.adaptTo(FieldInjectionTestModel.class); + + assertNotNull("Model is null", model); + assertEquals("Test Property is not set correctly", value, model.getTestProperty()); + assertEquals("Child Test Property is not set correctly", childValue, model.getChildProperty()); + assertNotNull("Filters is null", model.getFilters()); + assertSame("Adaptable is not injected", resource, model.getResource()); + } + + @Test + public void testInterfaceInjection() { + InterfaceInjectionTestModel model = resource.adaptTo(InterfaceInjectionTestModel.class); + + assertNotNull("Model is null", model); + assertEquals("Test Property is not set correctly", value, model.getTestProperty()); + assertNotNull("Filters is null", model.getFilters()); + assertSame("Adaptable is not injected", resource, model.getResource()); + } + + @Test + public void testConstructorInjection() { + ConstructorInjectionTestModel model = resource.adaptTo(ConstructorInjectionTestModel.class); + + assertNotNull("Model is null", model); + assertEquals("Test Property is not set correctly", value, model.getTestProperty()); + assertNotNull("Filters is null", model.getFilters()); + assertSame("Adaptable is not injected", resource, model.getResource()); + } +} diff --git a/it/src/test/java/org/apache/sling/models/testing/ViaIT.java b/it/src/test/java/org/apache/sling/models/testing/ViaIT.java new file mode 100644 index 00000000..07f973e2 --- /dev/null +++ b/it/src/test/java/org/apache/sling/models/testing/ViaIT.java @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.testing; + +import javax.jcr.Node; +import javax.jcr.Session; + +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.sling.api.adapter.AdapterManager; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.junit.rules.TeleporterRule; +import org.apache.sling.models.it.models.SourceObject; +import org.apache.sling.models.it.models.ViaModel; +import org.junit.Rule; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +public class ViaIT { + + @Rule + public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "SM_Teleporter"); + + @Test + @SuppressWarnings("null") + public void test() throws Exception { + ResourceResolverFactory rrFactory = teleporter.getService(ResourceResolverFactory.class); + AdapterManager adapterManager = teleporter.getService(AdapterManager.class); + + String value = RandomStringUtils.randomAlphanumeric(10); + + ResourceResolver resolver = null; + Node createdNode = null; + try { + resolver = rrFactory.getServiceResourceResolver(null); + Session session = resolver.adaptTo(Session.class); + Node rootNode = session.getRootNode(); + createdNode = rootNode.addNode("test_" + RandomStringUtils.randomAlphanumeric(10)); + createdNode.setProperty("testProperty", value); + session.save(); + + Resource resource = resolver.getResource(createdNode.getPath()); + SourceObject obj = new SourceObject(resource); + + ViaModel model = adapterManager.getAdapter(obj, ViaModel.class); + + assertNotNull("Model is null", model); + assertEquals("Test Property is not set correctly", value, model.getTestProperty()); + } finally { + if (createdNode != null) { + createdNode.remove(); + } + if (resolver != null) { + resolver.close(); + } + } + } +} diff --git a/it/src/test/java/org/apache/sling/models/testing/delegate/DelegateRequestIT.java b/it/src/test/java/org/apache/sling/models/testing/delegate/DelegateRequestIT.java new file mode 100644 index 00000000..a6b494a7 --- /dev/null +++ b/it/src/test/java/org/apache/sling/models/testing/delegate/DelegateRequestIT.java @@ -0,0 +1,114 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.testing.delegate; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.sling.api.SlingConstants; +import org.apache.sling.api.resource.LoginException; +import org.apache.sling.api.resource.PersistenceException; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.ResourceUtil; +import org.apache.sling.junit.rules.TeleporterRule; +import org.apache.sling.models.factory.ModelFactory; +import org.apache.sling.models.it.delegate.request.DelegateBaseModel; +import org.apache.sling.models.it.delegate.request.DelegateExtendedModel; +import org.apache.sling.models.it.delegate.request.DelegateInterface; +import org.apache.sling.models.testing.rtbound.FakeRequest; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +public class DelegateRequestIT { + + @Rule + public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "SM_Teleporter"); + + private ResourceResolverFactory rrFactory; + + private ModelFactory modelFactory; + + private final String baseComponentPath = "/content/delegate/baseComponent"; + private final String extendedComponentPath = "/content/delegate/extendedComponent"; + + @Before + @SuppressWarnings("null") + public void setup() throws LoginException, PersistenceException { + rrFactory = teleporter.getService(ResourceResolverFactory.class); + modelFactory = teleporter.getService(ModelFactory.class); + try (ResourceResolver adminResolver = rrFactory.getServiceResourceResolver(null); ) { + + Map properties = new HashMap(); + properties.put("text", "baseTESTValue"); + properties.put("other", "baseOther"); + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, + "sling/delegate/base"); + ResourceUtil.getOrCreateResource(adminResolver, baseComponentPath, properties, null, false); + properties.clear(); + + properties.put("text", "extendedTESTValue"); + properties.put("other", "extendedOther"); + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, + "sling/delegate/extended"); + ResourceUtil.getOrCreateResource(adminResolver, extendedComponentPath, properties, null, false); + properties.clear(); + + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_SUPER_TYPE, + "sling/delegate/base"); + ResourceUtil.getOrCreateResource(adminResolver, "/apps/sling/delegate/extended", properties, null, false); + properties.clear(); + + adminResolver.commit(); + } + } + + @Test + public void testCreateDelegateModel() throws LoginException { + try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { + final Resource baseComponentResource = resolver.getResource(baseComponentPath); + assertNotNull(baseComponentResource); + final FakeRequest baseRequest = new FakeRequest(baseComponentResource); + final DelegateInterface modelFromBase = modelFactory.createModel(baseRequest, DelegateInterface.class); + assertNotNull("Base Model should not be null", modelFromBase); + assertTrue("Model should be DelegateBaseModel", modelFromBase instanceof DelegateBaseModel); + assertEquals("baseTESTValue", modelFromBase.getText()); + assertEquals("baseOther", modelFromBase.getOther()); + + final Resource extendedComponentResource = resolver.getResource(extendedComponentPath); + assertNotNull(extendedComponentResource); + final FakeRequest extendedRequest = new FakeRequest(extendedComponentResource); + final DelegateInterface modelFromExtended = + modelFactory.createModel(extendedRequest, DelegateInterface.class); + assertNotNull("Extended Model should not be null", modelFromExtended); + assertTrue("Model should be DelegateExtendedModel", modelFromExtended instanceof DelegateExtendedModel); + assertEquals("EXTENDEDTESTVALUE", modelFromExtended.getText()); + assertEquals("extendedOther", modelFromExtended.getOther()); + } + } +} diff --git a/it/src/test/java/org/apache/sling/models/testing/delegate/DelegateResourceIT.java b/it/src/test/java/org/apache/sling/models/testing/delegate/DelegateResourceIT.java new file mode 100644 index 00000000..97f80949 --- /dev/null +++ b/it/src/test/java/org/apache/sling/models/testing/delegate/DelegateResourceIT.java @@ -0,0 +1,105 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.testing.delegate; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.sling.api.SlingConstants; +import org.apache.sling.api.resource.LoginException; +import org.apache.sling.api.resource.PersistenceException; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.ResourceUtil; +import org.apache.sling.junit.rules.TeleporterRule; +import org.apache.sling.models.it.delegate.resource.DelegateBaseModel; +import org.apache.sling.models.it.delegate.resource.DelegateExtendedModel; +import org.apache.sling.models.it.delegate.resource.DelegateInterface; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +public class DelegateResourceIT { + + @Rule + public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "SM_Teleporter"); + + private ResourceResolverFactory rrFactory; + + private final String baseComponentPath = "/content/delegate/baseComponent"; + private final String extendedComponentPath = "/content/delegate/extendedComponent"; + + @Before + @SuppressWarnings("null") + public void setup() throws LoginException, PersistenceException { + rrFactory = teleporter.getService(ResourceResolverFactory.class); + try (ResourceResolver adminResolver = rrFactory.getServiceResourceResolver(null); ) { + Map properties = new HashMap(); + properties.put("text", "baseTESTValue"); + properties.put("other", "baseOther"); + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, + "sling/delegate/base"); + ResourceUtil.getOrCreateResource(adminResolver, baseComponentPath, properties, null, false); + properties.clear(); + + properties.put("text", "extendedTESTValue"); + properties.put("other", "extendedOther"); + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, + "sling/delegate/extended"); + ResourceUtil.getOrCreateResource(adminResolver, extendedComponentPath, properties, null, false); + properties.clear(); + + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_SUPER_TYPE, + "sling/delegate/base"); + ResourceUtil.getOrCreateResource(adminResolver, "/apps/sling/delegate/extended", properties, null, false); + properties.clear(); + + adminResolver.commit(); + } + } + + @Test + public void testCreateDelegateModel() throws LoginException { + try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { + final Resource baseComponentResource = resolver.getResource(baseComponentPath); + assertNotNull(baseComponentResource); + final DelegateInterface modelFromBase = baseComponentResource.adaptTo(DelegateInterface.class); + assertNotNull("Model should not be null", modelFromBase); + assertTrue("Model should be DelegateBaseModel", modelFromBase instanceof DelegateBaseModel); + assertEquals("baseTESTValue", modelFromBase.getText()); + assertEquals("baseOther", modelFromBase.getOther()); + + final Resource extendedComponentResource = resolver.getResource(extendedComponentPath); + assertNotNull(extendedComponentResource); + final DelegateInterface modelFromExtended = extendedComponentResource.adaptTo(DelegateInterface.class); + assertNotNull("Model should not be null", modelFromExtended); + assertTrue("Model should be DelegateExtendedModel", modelFromExtended instanceof DelegateExtendedModel); + assertEquals("EXTENDEDTESTVALUE", modelFromExtended.getText()); + assertEquals("extendedOther", modelFromExtended.getOther()); + } + } +} diff --git a/it/src/test/java/org/apache/sling/models/testing/delegate/viaoriginalresource/ViaOriginalResourceDelegationIT.java b/it/src/test/java/org/apache/sling/models/testing/delegate/viaoriginalresource/ViaOriginalResourceDelegationIT.java new file mode 100644 index 00000000..ee119b77 --- /dev/null +++ b/it/src/test/java/org/apache/sling/models/testing/delegate/viaoriginalresource/ViaOriginalResourceDelegationIT.java @@ -0,0 +1,139 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.testing.delegate.viaoriginalresource; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.sling.api.resource.LoginException; +import org.apache.sling.api.resource.PersistenceException; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.ResourceUtil; +import org.apache.sling.junit.rules.TeleporterRule; +import org.apache.sling.models.factory.ModelFactory; +import org.apache.sling.models.it.delegate.viaoriginalresource.A; +import org.apache.sling.models.it.delegate.viaoriginalresource.models.A1Impl; +import org.apache.sling.models.it.delegate.viaoriginalresource.models.AImpl; +import org.apache.sling.models.it.delegate.viaoriginalresource.models.B1Impl; +import org.apache.sling.models.it.delegate.viaoriginalresource.models.BImpl; +import org.apache.sling.models.testing.rtbound.FakeRequest; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; + +public class ViaOriginalResourceDelegationIT { + + @Rule + public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "SM_Teleporter"); + + private ResourceResolverFactory rrFactory; + + private ModelFactory modelFactory; + + private final String genericComponent = "/apps/delegate/nestedrtbound/generic"; + private final String specificComponent = "/apps/delegate/nestedrtbound/specific"; + private final String genericContent = "/content/delegate/nestedrtbound/generic"; + private final String specificContent = "/content/delegate/nestedrtbound/specific"; + + @Before + @SuppressWarnings("null") + public void setup() throws LoginException, PersistenceException { + rrFactory = teleporter.getService(ResourceResolverFactory.class); + modelFactory = teleporter.getService(ModelFactory.class); + try (ResourceResolver adminResolver = rrFactory.getServiceResourceResolver(null); ) { + + Map properties = new HashMap(); + ResourceUtil.getOrCreateResource(adminResolver, genericComponent, properties, null, false); + properties.clear(); + + properties.put("sling:resourceSuperType", "delegate/nestedrtbound/generic"); + ResourceUtil.getOrCreateResource(adminResolver, specificComponent, properties, null, false); + properties.clear(); + + properties.put("sling:resourceType", "delegate/nestedrtbound/generic"); + ResourceUtil.getOrCreateResource(adminResolver, genericContent, properties, null, false); + properties.clear(); + + properties.put("sling:resourceType", "delegate/nestedrtbound/specific"); + ResourceUtil.getOrCreateResource(adminResolver, specificContent, properties, null, false); + properties.clear(); + + adminResolver.commit(); + } + } + + @Test + public void testGenericModelFromRequest() throws LoginException { + try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { + final Resource content = resolver.getResource(genericContent); + final FakeRequest baseRequest = new FakeRequest(content); + + final A model = modelFactory.createModel(baseRequest, A.class); + assertTrue(model instanceof AImpl); + assertTrue(((AImpl) model).other instanceof BImpl); + } + } + + @Test + public void testSpecificModelFromRequest() throws LoginException { + try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { + final Resource content = resolver.getResource(specificContent); + final FakeRequest baseRequest = new FakeRequest(content); + + final A model = modelFactory.createModel(baseRequest, A.class); + assertTrue(model instanceof A1Impl); + assertTrue(((A1Impl) model).other instanceof B1Impl); + assertTrue(((A1Impl) model).delegate instanceof AImpl); + assertTrue(((AImpl) ((A1Impl) model).delegate).other instanceof B1Impl); + // Since SLING-11133 and cache = true + assertSame(((A1Impl) model).other, ((AImpl) ((A1Impl) model).delegate).other); + } + } + + @Test + public void testGenericModelFromResource() throws LoginException { + try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { + final Resource content = resolver.getResource(genericContent); + + final A model = modelFactory.createModel(content, A.class); + assertTrue(model instanceof AImpl); + assertTrue(((AImpl) model).other instanceof BImpl); + } + } + + @Test + public void testSpecificModelFromResource() throws LoginException { + try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { + final Resource content = resolver.getResource(specificContent); + + final A model = modelFactory.createModel(content, A.class); + assertTrue(model instanceof A1Impl); + assertTrue(((A1Impl) model).other instanceof B1Impl); + assertTrue(((A1Impl) model).delegate instanceof AImpl); + assertTrue(((AImpl) ((A1Impl) model).delegate).other instanceof B1Impl); + // Since SLING-11133 and cache = true + assertSame(((A1Impl) model).other, ((AImpl) ((A1Impl) model).delegate).other); + } + } +} diff --git a/it/src/test/java/org/apache/sling/models/testing/exporter/ExporterIT.java b/it/src/test/java/org/apache/sling/models/testing/exporter/ExporterIT.java new file mode 100644 index 00000000..4dae2767 --- /dev/null +++ b/it/src/test/java/org/apache/sling/models/testing/exporter/ExporterIT.java @@ -0,0 +1,344 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.testing.exporter; + +import javax.json.Json; +import javax.json.JsonObject; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.StringReader; +import java.text.Format; +import java.util.Calendar; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.TimeZone; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.time.FastDateFormat; +import org.apache.sling.api.SlingConstants; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.ResourceUtil; +import org.apache.sling.engine.SlingRequestProcessor; +import org.apache.sling.junit.rules.TeleporterRule; +import org.apache.sling.models.factory.MissingExporterException; +import org.apache.sling.models.factory.ModelFactory; +import org.apache.sling.models.testing.helper.FakeRequest; +import org.apache.sling.models.testing.helper.FakeResponse; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +public class ExporterIT { + + @Rule + public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "SM_Teleporter"); + + private ResourceResolverFactory rrFactory; + + private ModelFactory modelFactory; + + private SlingRequestProcessor slingRequestProcessor; + + private final String baseComponentPath = "/content/exp/baseComponent"; + private final String doubledComponentPath = "/content/exp/doubledComponent"; + private final String childComponentPath = "/content/exp/childComponent"; + private final String extendedComponentPath = "/content/exp/extendedComponent"; + private final String interfaceComponentPath = "/content/exp/interfaceComponent"; + private final String baseRequestComponentPath = "/content/exp-request/baseComponent"; + private final String extendedRequestComponentPath = "/content/exp-request/extendedComponent"; + private final String interfaceRequestComponentPath = "/content/exp-request/interfaceComponent"; + private Calendar testDate; + + private Format dateFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSSZ", TimeZone.getTimeZone("UTC")); + + @Before + @SuppressWarnings("null") + public void setup() throws Exception { + rrFactory = teleporter.getService(ResourceResolverFactory.class); + modelFactory = teleporter.getService(ModelFactory.class); + slingRequestProcessor = teleporter.getService(SlingRequestProcessor.class); + + try (ResourceResolver adminResolver = rrFactory.getServiceResourceResolver(null); ) { + Map properties = new HashMap(); + properties.put("sampleValue", "baseTESTValue"); + properties.put("sampleBooleanValue", true); + properties.put("sampleLongValue", 1l); + properties.put("sampleDoubleValue", 1d); + properties.put("sampleArray", new String[] {"a", "b", "c"}); + properties.put("sampleEmptyArray", new String[0]); + properties.put("sampleBinary", new ByteArrayInputStream("abc".getBytes("UTF-8"))); + properties.put("sampleBinaryArray", new InputStream[] { + new ByteArrayInputStream("abc".getBytes("UTF-8")), new ByteArrayInputStream("def".getBytes("UTF-8")) + }); + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, "sling/exp/base"); + ResourceUtil.getOrCreateResource(adminResolver, baseComponentPath, properties, null, false); + + ResourceUtil.getOrCreateResource( + adminResolver, baseComponentPath + "/child", Collections.emptyMap(), null, false); + + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, + "sling/exp-request/base"); + ResourceUtil.getOrCreateResource(adminResolver, baseRequestComponentPath, properties, null, false); + properties.clear(); + + properties.put("sampleValue", "childTESTValue"); + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, "sling/exp/child"); + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_SUPER_TYPE, + "sling/exp/base"); + ResourceUtil.getOrCreateResource(adminResolver, childComponentPath, properties, null, false); + properties.clear(); + + properties.put("sampleValue", "extendedTESTValue"); + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, + "sling/exp/extended"); + testDate = Calendar.getInstance(); + testDate.setTimeZone(TimeZone.getTimeZone("UTC")); + testDate.setTimeInMillis(0); + testDate.set(2015, 6, 29); + properties.put("date", testDate); + ResourceUtil.getOrCreateResource(adminResolver, extendedComponentPath, properties, null, false); + + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, + "sling/exp-request/extended"); + ResourceUtil.getOrCreateResource(adminResolver, extendedRequestComponentPath, properties, null, false); + properties.clear(); + + properties.put("sampleValue", "interfaceTESTValue"); + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, + "sling/exp/interface"); + ResourceUtil.getOrCreateResource(adminResolver, interfaceComponentPath, properties, null, false); + + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, + "sling/exp-request/interface"); + ResourceUtil.getOrCreateResource(adminResolver, interfaceRequestComponentPath, properties, null, false); + properties.clear(); + + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, "sling/exp/doubled"); + ResourceUtil.getOrCreateResource(adminResolver, doubledComponentPath, properties, null, false); + + adminResolver.commit(); + } + } + + @Test + @SuppressWarnings("null") + public void testExportToJSON() throws Exception { + try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { + final Resource baseComponentResource = resolver.getResource(baseComponentPath); + Assert.assertNotNull(baseComponentResource); + String jsonData = modelFactory.exportModelForResource( + baseComponentResource, "jackson", String.class, Collections.emptyMap()); + Assert.assertTrue( + "JSON Data should contain the property value", StringUtils.contains(jsonData, "baseTESTValue")); + + JsonObject parsed = Json.createReader(new StringReader(jsonData)).readObject(); + JsonObject resource = parsed.getJsonObject("resource"); + Assert.assertEquals(3, resource.getJsonArray("sampleArray").size()); + Assert.assertEquals( + 1.0d, resource.getJsonNumber("sampleDoubleValue").doubleValue(), .1); + Assert.assertEquals(2, resource.getJsonArray(":sampleBinaryArray").size()); + Assert.assertTrue(resource.getBoolean("sampleBooleanValue")); + Assert.assertEquals(1, resource.getInt("sampleLongValue")); + Assert.assertEquals(3, resource.getInt(":sampleBinary")); + Assert.assertEquals(0, resource.getJsonArray("sampleEmptyArray").size()); + + final Resource extendedComponentResource = resolver.getResource(extendedComponentPath); + Assert.assertNotNull(extendedComponentResource); + jsonData = modelFactory.exportModelForResource( + extendedComponentResource, "jackson", String.class, Collections.emptyMap()); + Assert.assertTrue( + "JSON Data should contain the property value", StringUtils.contains(jsonData, "extendedTESTValue")); + + final Resource interfaceComponentResource = resolver.getResource(interfaceComponentPath); + Assert.assertNotNull(baseComponentResource); + jsonData = modelFactory.exportModelForResource( + interfaceComponentResource, "jackson", String.class, Collections.emptyMap()); + Assert.assertTrue( + "JSON Data should contain the property value", + StringUtils.contains(jsonData, "interfaceTESTValue")); + } + } + + @Test + public void testExportToTidyJSON() throws Exception { + try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { + final Resource baseComponentResource = resolver.getResource(baseComponentPath); + Assert.assertNotNull(baseComponentResource); + String jsonData = modelFactory.exportModelForResource( + baseComponentResource, "jackson", String.class, Collections.emptyMap()); + Assert.assertFalse(jsonData.contains(System.lineSeparator())); + + jsonData = modelFactory.exportModelForResource( + baseComponentResource, + "jackson", + String.class, + Collections.singletonMap("tidy", "true")); + Assert.assertTrue(jsonData.contains(System.lineSeparator())); + } + } + + @SuppressWarnings("unchecked") + @Test + public void testExportToMap() throws Exception { + try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { + final Resource baseComponentResource = resolver.getResource(baseComponentPath); + Assert.assertNotNull(baseComponentResource); + Map data = modelFactory.exportModelForResource( + baseComponentResource, "jackson", Map.class, Collections.emptyMap()); + Assert.assertEquals("Should have resource value", "baseTESTValue", data.get("sampleValue")); + Assert.assertEquals("Should have resource value", "BASETESTVALUE", data.get("UPPER")); + } + } + + @Test + public void testResourceServlets() throws Exception { + try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { + FakeResponse response = new FakeResponse(); + slingRequestProcessor.processRequest( + new FakeRequest(baseComponentPath + ".model.json"), response, resolver); + JsonObject obj = Json.createReader( + new StringReader((response.getStringWriter().toString()))) + .readObject(); + Assert.assertEquals("application/json", response.getContentType()); + Assert.assertEquals("UTF-8", response.getCharacterEncoding()); + Assert.assertEquals("BASETESTVALUE", obj.getString("UPPER")); + Assert.assertEquals(baseComponentPath, obj.getString("id")); + + response = new FakeResponse(); + slingRequestProcessor.processRequest( + new FakeRequest(extendedComponentPath + ".model.json"), response, resolver); + obj = Json.createReader(new StringReader((response.getStringWriter().toString()))) + .readObject(); + Assert.assertEquals("application/json", response.getContentType()); + Assert.assertEquals("UTF-8", response.getCharacterEncoding()); + Assert.assertEquals(extendedComponentPath, obj.getString("id")); + Assert.assertEquals( + testDate.getTimeInMillis(), obj.getJsonNumber("date").longValue()); + + response = new FakeResponse(); + slingRequestProcessor.processRequest( + new FakeRequest(interfaceComponentPath + ".model.json"), response, resolver); + obj = Json.createReader(new StringReader((response.getStringWriter().toString()))) + .readObject(); + Assert.assertEquals("application/json", response.getContentType()); + Assert.assertEquals("UTF-8", response.getCharacterEncoding()); + Assert.assertEquals(interfaceComponentPath, obj.getString("id")); + Assert.assertEquals("interfaceTESTValue", obj.getString("sampleValue")); + } + } + + @Test + public void testRequestServlets() throws Exception { + try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { + FakeResponse response = new FakeResponse(); + slingRequestProcessor.processRequest( + new FakeRequest(baseRequestComponentPath + ".model.json"), response, resolver); + String stringOutput = response.getStringWriter().toString(); + + Assert.assertTrue(stringOutput.startsWith("{\"UPPER\":")); + + JsonObject obj = Json.createReader(new StringReader(stringOutput)).readObject(); + Assert.assertEquals("application/json", response.getContentType()); + Assert.assertEquals("UTF-8", response.getCharacterEncoding()); + Assert.assertEquals("BASETESTVALUE", obj.getString("UPPER")); + Assert.assertTrue(obj.containsKey("testBindingsObject")); + JsonObject testBindingsObject = obj.getJsonObject("testBindingsObject"); + Assert.assertEquals("value", testBindingsObject.getString("name")); + Assert.assertTrue(obj.containsKey("testBindingsObject2")); + JsonObject testBindingsObject2 = obj.getJsonObject("testBindingsObject2"); + Assert.assertEquals("value2", testBindingsObject2.getString("name2")); + Assert.assertEquals(baseRequestComponentPath, obj.getString("id")); + + response = new FakeResponse(); + slingRequestProcessor.processRequest( + new FakeRequest(extendedRequestComponentPath + ".model.json"), response, resolver); + obj = Json.createReader(new StringReader((response.getStringWriter().toString()))) + .readObject(); + Assert.assertEquals("application/json", response.getContentType()); + Assert.assertEquals("UTF-8", response.getCharacterEncoding()); + Assert.assertEquals(extendedRequestComponentPath, obj.getString("id")); + Assert.assertEquals(dateFormat.format(testDate), obj.getString("date")); + + response = new FakeResponse(); + slingRequestProcessor.processRequest( + new FakeRequest(interfaceRequestComponentPath + ".model.json"), response, resolver); + obj = Json.createReader(new StringReader((response.getStringWriter().toString()))) + .readObject(); + Assert.assertEquals("application/json", response.getContentType()); + Assert.assertEquals("UTF-8", response.getCharacterEncoding()); + Assert.assertEquals(interfaceRequestComponentPath, obj.getString("id")); + Assert.assertEquals("interfaceTESTValue", obj.getString("sampleValue")); + } + } + + @Test + public void testDoubledServlets() throws Exception { + try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { + FakeResponse response = new FakeResponse(); + slingRequestProcessor.processRequest( + new FakeRequest(doubledComponentPath + ".firstmodel.json"), response, resolver); + + JsonObject obj = Json.createReader( + new StringReader((response.getStringWriter().toString()))) + .readObject(); + Assert.assertEquals("application/json", response.getContentType()); + Assert.assertEquals("first", obj.getString("value")); + + response = new FakeResponse(); + slingRequestProcessor.processRequest( + new FakeRequest(doubledComponentPath + ".secondmodel.json"), response, resolver); + obj = Json.createReader(new StringReader((response.getStringWriter().toString()))) + .readObject(); + Assert.assertEquals("application/json", response.getContentType()); + Assert.assertEquals("second", obj.getString("value")); + } + } + + @Test + public void testFailedExport() throws Exception { + boolean thrown = false; + try { + try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { + final Resource baseComponentResource = resolver.getResource(baseComponentPath); + Assert.assertNotNull(baseComponentResource); + modelFactory.exportModelForResource( + baseComponentResource, "jaxb", String.class, Collections.emptyMap()); + Assert.fail("Should have thrown missing serializer error."); + } + } catch (MissingExporterException e) { + thrown = true; + Assert.assertEquals("No exporter named jaxb supports java.lang.String.", e.getMessage()); + } + Assert.assertTrue(thrown); + } +} diff --git a/it/src/test/java/org/apache/sling/models/testing/helper/FakeRequest.java b/it/src/test/java/org/apache/sling/models/testing/helper/FakeRequest.java new file mode 100644 index 00000000..1290f8ac --- /dev/null +++ b/it/src/test/java/org/apache/sling/models/testing/helper/FakeRequest.java @@ -0,0 +1,400 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.testing.helper; + +import javax.servlet.AsyncContext; +import javax.servlet.DispatcherType; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletInputStream; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import javax.servlet.http.HttpUpgradeHandler; +import javax.servlet.http.Part; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.security.Principal; +import java.util.Collection; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +public class FakeRequest implements HttpServletRequest { + + private final String path; + + private final StringBuffer requestUrl; + + private final Map attributes = new HashMap(); + + public FakeRequest(String path) { + this.path = path; + this.requestUrl = new StringBuffer("http://notarealhost").append(path); + } + + @Override + public String getAuthType() { + return null; + } + + @Override + public Cookie[] getCookies() { + return new Cookie[0]; + } + + @Override + public long getDateHeader(String name) { + return 0; + } + + @Override + public String getHeader(String name) { + return null; + } + + @Override + public Enumeration getHeaders(String name) { + return null; + } + + @Override + public Enumeration getHeaderNames() { + return null; + } + + @Override + public int getIntHeader(String name) { + return 0; + } + + @Override + public String getMethod() { + return "GET"; + } + + @Override + public String getPathInfo() { + return path; + } + + @Override + public String getPathTranslated() { + return null; + } + + @Override + public String getContextPath() { + return null; + } + + @Override + public String getQueryString() { + return null; + } + + @Override + public String getRemoteUser() { + return null; + } + + @Override + public boolean isUserInRole(String role) { + return false; + } + + @Override + public Principal getUserPrincipal() { + return null; + } + + @Override + public String getRequestedSessionId() { + return null; + } + + @Override + public String getRequestURI() { + return null; + } + + @Override + public StringBuffer getRequestURL() { + return requestUrl; + } + + @Override + public String getServletPath() { + return ""; + } + + @Override + public HttpSession getSession(boolean create) { + return null; + } + + @Override + public HttpSession getSession() { + return null; + } + + @Override + public boolean isRequestedSessionIdValid() { + return false; + } + + @Override + public boolean isRequestedSessionIdFromCookie() { + return false; + } + + @Override + public boolean isRequestedSessionIdFromURL() { + return false; + } + + @Override + public boolean isRequestedSessionIdFromUrl() { + return false; + } + + @Override + public Object getAttribute(String name) { + return attributes.get(name); + } + + @Override + public Enumeration getAttributeNames() { + return null; + } + + @Override + public String getCharacterEncoding() { + return null; + } + + @Override + public void setCharacterEncoding(String env) throws UnsupportedEncodingException {} + + @Override + public int getContentLength() { + return 0; + } + + @Override + public String getContentType() { + return null; + } + + @Override + public ServletInputStream getInputStream() throws IOException { + return null; + } + + @Override + public String getParameter(String name) { + return null; + } + + @Override + public Enumeration getParameterNames() { + return null; + } + + @Override + public String[] getParameterValues(String name) { + return new String[0]; + } + + @Override + public Map getParameterMap() { + return Collections.emptyMap(); + } + + @Override + public String getProtocol() { + return null; + } + + @Override + public String getScheme() { + return null; + } + + @Override + public String getServerName() { + return null; + } + + @Override + public int getServerPort() { + return 0; + } + + @Override + public BufferedReader getReader() throws IOException { + return null; + } + + @Override + public String getRemoteAddr() { + return null; + } + + @Override + public String getRemoteHost() { + return null; + } + + @Override + public void setAttribute(String name, Object o) { + attributes.put(name, o); + } + + @Override + public void removeAttribute(String name) { + attributes.remove(name); + } + + @Override + public Locale getLocale() { + return null; + } + + @Override + public Enumeration getLocales() { + return Collections.emptyEnumeration(); + } + + @Override + public boolean isSecure() { + return false; + } + + @Override + public RequestDispatcher getRequestDispatcher(String path) { + return null; + } + + @Override + public String getRealPath(String path) { + return null; + } + + @Override + public int getRemotePort() { + return 0; + } + + @Override + public String getLocalName() { + return null; + } + + @Override + public String getLocalAddr() { + return null; + } + + @Override + public int getLocalPort() { + return 0; + } + + @Override + public long getContentLengthLong() { + return 0; + } + + @Override + public ServletContext getServletContext() { + return null; + } + + @Override + public AsyncContext startAsync() throws IllegalStateException { + return null; + } + + @Override + public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) + throws IllegalStateException { + return null; + } + + @Override + public boolean isAsyncStarted() { + return false; + } + + @Override + public boolean isAsyncSupported() { + return false; + } + + @Override + public AsyncContext getAsyncContext() { + return null; + } + + @Override + public DispatcherType getDispatcherType() { + return null; + } + + @Override + public String changeSessionId() { + return null; + } + + @Override + public boolean authenticate(HttpServletResponse response) throws IOException, ServletException { + return false; + } + + @Override + public void login(String username, String password) throws ServletException {} + + @Override + public void logout() throws ServletException {} + + @Override + public Collection getParts() throws IOException, ServletException { + return null; + } + + @Override + public Part getPart(String name) throws IOException, ServletException { + return null; + } + + @Override + @SuppressWarnings("null") + public T upgrade(Class handlerClass) throws IOException, ServletException { + return null; + } +} diff --git a/it/src/test/java/org/apache/sling/models/testing/helper/FakeResponse.java b/it/src/test/java/org/apache/sling/models/testing/helper/FakeResponse.java new file mode 100644 index 00000000..fa474aab --- /dev/null +++ b/it/src/test/java/org/apache/sling/models/testing/helper/FakeResponse.java @@ -0,0 +1,191 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.testing.helper; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletResponse; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Collection; +import java.util.Locale; + +public class FakeResponse implements HttpServletResponse { + + private StringWriter stringWriter = new StringWriter(); + private String contentType = null; + private String characterEncoding = null; + private int status = -1; + + @Override + public void addCookie(Cookie cookie) {} + + @Override + public boolean containsHeader(String name) { + return false; + } + + @Override + public String encodeURL(String url) { + return null; + } + + @Override + public String encodeRedirectURL(String url) { + return null; + } + + @Override + public String encodeUrl(String url) { + return null; + } + + @Override + public String encodeRedirectUrl(String url) { + return null; + } + + @Override + public void sendError(int sc, String msg) throws IOException {} + + @Override + public void sendError(int sc) throws IOException {} + + @Override + public void sendRedirect(String location) throws IOException {} + + @Override + public void setDateHeader(String name, long date) {} + + @Override + public void addDateHeader(String name, long date) {} + + @Override + public void setHeader(String name, String value) {} + + @Override + public void addHeader(String name, String value) {} + + @Override + public void setIntHeader(String name, int value) {} + + @Override + public void addIntHeader(String name, int value) {} + + @Override + public void setStatus(int sc) { + this.status = sc; + } + + @Override + public void setStatus(int sc, String sm) { + setStatus(sc); + } + + @Override + public String getCharacterEncoding() { + return characterEncoding; + } + + @Override + public String getContentType() { + return contentType; + } + + @Override + public ServletOutputStream getOutputStream() throws IOException { + return null; + } + + @Override + public PrintWriter getWriter() throws IOException { + return new PrintWriter(stringWriter); + } + + @Override + public void setCharacterEncoding(String charset) { + this.characterEncoding = charset; + } + + @Override + public void setContentLength(int len) {} + + @Override + public void setContentType(String type) { + this.contentType = type; + } + + @Override + public void setBufferSize(int size) {} + + @Override + public int getBufferSize() { + return 0; + } + + @Override + public void flushBuffer() throws IOException {} + + @Override + public void resetBuffer() {} + + @Override + public boolean isCommitted() { + return false; + } + + @Override + public void reset() {} + + @Override + public void setLocale(Locale loc) {} + + @Override + public Locale getLocale() { + return null; + } + + public StringWriter getStringWriter() { + return stringWriter; + } + + public int getStatus() { + return status; + } + + @Override + public void setContentLengthLong(long len) {} + + @Override + public String getHeader(String name) { + return null; + } + + @Override + public Collection getHeaders(String name) { + return null; + } + + @Override + public Collection getHeaderNames() { + return null; + } +} diff --git a/it/src/test/java/org/apache/sling/models/testing/rtbound/FakeRequest.java b/it/src/test/java/org/apache/sling/models/testing/rtbound/FakeRequest.java new file mode 100644 index 00000000..56a8a78b --- /dev/null +++ b/it/src/test/java/org/apache/sling/models/testing/rtbound/FakeRequest.java @@ -0,0 +1,498 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.testing.rtbound; + +import javax.servlet.AsyncContext; +import javax.servlet.DispatcherType; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletInputStream; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import javax.servlet.http.HttpUpgradeHandler; +import javax.servlet.http.Part; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.security.Principal; +import java.util.Collection; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.ResourceBundle; + +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.api.request.RequestDispatcherOptions; +import org.apache.sling.api.request.RequestParameter; +import org.apache.sling.api.request.RequestParameterMap; +import org.apache.sling.api.request.RequestPathInfo; +import org.apache.sling.api.request.RequestProgressTracker; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.jetbrains.annotations.NotNull; + +public class FakeRequest implements SlingHttpServletRequest { + + private final Resource resource; + private final Map attributes = new HashMap<>(); + + public FakeRequest(Resource r) { + this.resource = r; + } + + @Override + public @NotNull Resource getResource() { + return resource; + } + + @Override + @SuppressWarnings("null") + public @NotNull ResourceResolver getResourceResolver() { + return null; + } + + @Override + @SuppressWarnings("null") + public @NotNull RequestPathInfo getRequestPathInfo() { + return null; + } + + @Override + public RequestParameter getRequestParameter(@NotNull String s) { + return null; + } + + @Override + public RequestParameter[] getRequestParameters(@NotNull String s) { + return new RequestParameter[0]; + } + + @Override + @SuppressWarnings("null") + public @NotNull RequestParameterMap getRequestParameterMap() { + return null; + } + + @Override + public RequestDispatcher getRequestDispatcher( + @NotNull String s, RequestDispatcherOptions requestDispatcherOptions) { + return null; + } + + @Override + public RequestDispatcher getRequestDispatcher( + @NotNull Resource resource, RequestDispatcherOptions requestDispatcherOptions) { + return null; + } + + @Override + public RequestDispatcher getRequestDispatcher(@NotNull Resource resource) { + return null; + } + + @Override + public Cookie getCookie(String s) { + return null; + } + + @Override + public String getResponseContentType() { + return null; + } + + @Override + @SuppressWarnings("null") + public @NotNull Enumeration getResponseContentTypes() { + return null; + } + + @Override + public ResourceBundle getResourceBundle(Locale locale) { + return null; + } + + @Override + public ResourceBundle getResourceBundle(String s, Locale locale) { + return null; + } + + @Override + @SuppressWarnings("null") + public RequestProgressTracker getRequestProgressTracker() { + return null; + } + + @Override + public String getAuthType() { + return null; + } + + @Override + public Cookie[] getCookies() { + return new Cookie[0]; + } + + @Override + public long getDateHeader(String s) { + return 0; + } + + @Override + public String getHeader(String s) { + return null; + } + + @Override + public Enumeration getHeaders(String s) { + return null; + } + + @Override + public Enumeration getHeaderNames() { + return null; + } + + @Override + public int getIntHeader(String s) { + return 0; + } + + @Override + public String getMethod() { + return null; + } + + @Override + public String getPathInfo() { + return null; + } + + @Override + public String getPathTranslated() { + return null; + } + + @Override + public String getContextPath() { + return null; + } + + @Override + public String getQueryString() { + return null; + } + + @Override + public String getRemoteUser() { + return null; + } + + @Override + public boolean isUserInRole(String s) { + return false; + } + + @Override + public Principal getUserPrincipal() { + return null; + } + + @Override + public String getRequestedSessionId() { + return null; + } + + @Override + public String getRequestURI() { + return null; + } + + @Override + public StringBuffer getRequestURL() { + return null; + } + + @Override + public String getServletPath() { + return null; + } + + @Override + public HttpSession getSession(boolean b) { + return null; + } + + @Override + public HttpSession getSession() { + return null; + } + + @Override + public boolean isRequestedSessionIdValid() { + return false; + } + + @Override + public boolean isRequestedSessionIdFromCookie() { + return false; + } + + @Override + public boolean isRequestedSessionIdFromURL() { + return false; + } + + @Override + public boolean isRequestedSessionIdFromUrl() { + return false; + } + + @Override + public Object getAttribute(String s) { + return attributes.get(s); + } + + @Override + public Enumeration getAttributeNames() { + return null; + } + + @Override + public String getCharacterEncoding() { + return null; + } + + @Override + public void setCharacterEncoding(String s) throws UnsupportedEncodingException {} + + @Override + public int getContentLength() { + return 0; + } + + @Override + public String getContentType() { + return null; + } + + @Override + public ServletInputStream getInputStream() throws IOException { + return null; + } + + @Override + public String getParameter(String s) { + return null; + } + + @Override + public Enumeration getParameterNames() { + return null; + } + + @Override + public String[] getParameterValues(String s) { + return new String[0]; + } + + @Override + public Map getParameterMap() { + return null; + } + + @Override + public String getProtocol() { + return null; + } + + @Override + public String getScheme() { + return null; + } + + @Override + public String getServerName() { + return null; + } + + @Override + public int getServerPort() { + return 0; + } + + @Override + public BufferedReader getReader() throws IOException { + return null; + } + + @Override + public String getRemoteAddr() { + return null; + } + + @Override + public String getRemoteHost() { + return null; + } + + @Override + public void setAttribute(String s, Object o) { + attributes.put(s, o); + } + + @Override + public void removeAttribute(String s) {} + + @Override + public Locale getLocale() { + return null; + } + + @Override + public Enumeration getLocales() { + return null; + } + + @Override + public boolean isSecure() { + return false; + } + + @Override + public RequestDispatcher getRequestDispatcher(String s) { + return null; + } + + @Override + public String getRealPath(String s) { + return null; + } + + @Override + public int getRemotePort() { + return 0; + } + + @Override + public String getLocalName() { + return null; + } + + @Override + public String getLocalAddr() { + return null; + } + + @Override + public int getLocalPort() { + return 0; + } + + @Override + @SuppressWarnings("null") + public AdapterType adaptTo(@NotNull Class aClass) { + return null; + } + + @Override + public String changeSessionId() { + return null; + } + + @Override + public boolean authenticate(HttpServletResponse response) throws IOException, ServletException { + return false; + } + + @Override + public void login(String username, String password) throws ServletException {} + + @Override + public void logout() throws ServletException {} + + @Override + public Collection getParts() throws IOException, ServletException { + return null; + } + + @Override + public Part getPart(String name) throws IOException, ServletException { + return null; + } + + @Override + @SuppressWarnings("null") + public T upgrade(Class handlerClass) throws IOException, ServletException { + return null; + } + + @Override + public long getContentLengthLong() { + return 0; + } + + @Override + public ServletContext getServletContext() { + return null; + } + + @Override + public AsyncContext startAsync() throws IllegalStateException { + return null; + } + + @Override + public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) + throws IllegalStateException { + return null; + } + + @Override + public boolean isAsyncStarted() { + return false; + } + + @Override + public boolean isAsyncSupported() { + return false; + } + + @Override + public AsyncContext getAsyncContext() { + return null; + } + + @Override + public DispatcherType getDispatcherType() { + return null; + } + + @Override + @SuppressWarnings("null") + public List getRequestParameterList() { + return null; + } +} diff --git a/it/src/test/java/org/apache/sling/models/testing/rtbound/ResourceTypeBindingIT.java b/it/src/test/java/org/apache/sling/models/testing/rtbound/ResourceTypeBindingIT.java new file mode 100644 index 00000000..74ec3303 --- /dev/null +++ b/it/src/test/java/org/apache/sling/models/testing/rtbound/ResourceTypeBindingIT.java @@ -0,0 +1,146 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.testing.rtbound; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.sling.api.SlingConstants; +import org.apache.sling.api.resource.LoginException; +import org.apache.sling.api.resource.PersistenceException; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.ResourceUtil; +import org.apache.sling.junit.rules.TeleporterRule; +import org.apache.sling.models.factory.ModelFactory; +import org.apache.sling.models.it.rtbound.BaseComponent; +import org.apache.sling.models.it.rtbound.ExtendedComponent; +import org.apache.sling.models.it.rtbound.FromRequestComponent; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +public class ResourceTypeBindingIT { + + @Rule + public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "SM_Teleporter"); + + private ResourceResolverFactory rrFactory; + + private ModelFactory modelFactory; + + private final String baseComponentPath = "/content/rt/baseComponent"; + private final String childComponentPath = "/content/rt/childComponent"; + private final String child2ComponentPath = "/content/rt/child2Component"; + private final String extendedComponentPath = "/content/rt/extendedComponent"; + private final String fromRequestComponentPath = "/content/rt/fromRequest"; + + @Before + @SuppressWarnings("null") + public void setup() throws LoginException, PersistenceException { + rrFactory = teleporter.getService(ResourceResolverFactory.class); + modelFactory = teleporter.getService(ModelFactory.class); + + try (ResourceResolver adminResolver = rrFactory.getServiceResourceResolver(null); ) { + Map properties = new HashMap(); + properties.put("sampleValue", "baseTESTValue"); + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, "sling/rt/base"); + ResourceUtil.getOrCreateResource(adminResolver, baseComponentPath, properties, null, false); + properties.clear(); + + properties.put("sampleValue", "childTESTValue"); + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, "sling/rt/child"); + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_SUPER_TYPE, + "sling/rt/base"); + ResourceUtil.getOrCreateResource(adminResolver, childComponentPath, properties, null, false); + properties.clear(); + + properties.put("sampleValue", "childTESTValue2"); + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, "sling/rt/child"); + ResourceUtil.getOrCreateResource(adminResolver, child2ComponentPath, properties, null, false); + properties.clear(); + + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_SUPER_TYPE, + "sling/rt/base"); + ResourceUtil.getOrCreateResource(adminResolver, "/apps/sling/rt/child", properties, null, false); + properties.clear(); + + properties.put("sampleValue", "extendedTESTValue"); + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, "sling/rt/extended"); + ResourceUtil.getOrCreateResource(adminResolver, extendedComponentPath, properties, null, false); + + properties.clear(); + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, + "sling/rt/fromRequest"); + ResourceUtil.getOrCreateResource(adminResolver, fromRequestComponentPath, properties, null, false); + + adminResolver.commit(); + } + } + + @Test + public void testClientModelCreateFromResource() throws LoginException { + try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { + final Resource baseComponentResource = resolver.getResource(baseComponentPath); + Assert.assertNotNull(baseComponentResource); + final Object baseModel = modelFactory.getModelFromResource(baseComponentResource); + Assert.assertNotNull("Model should not be null", baseModel); + Assert.assertTrue("Model should be a BaseComponent", baseModel instanceof BaseComponent); + + final Resource childComponentResource = resolver.getResource(childComponentPath); + Assert.assertNotNull(childComponentResource); + final Object childModel = modelFactory.getModelFromResource(childComponentResource); + Assert.assertNotNull("Model should not be null", childModel); + Assert.assertTrue("Model should be a BaseComponent", childModel instanceof BaseComponent); + + final Resource child2ComponentResource = resolver.getResource(child2ComponentPath); + Assert.assertNotNull(child2ComponentResource); + final Object child2Model = modelFactory.getModelFromResource(child2ComponentResource); + Assert.assertNotNull("Model should not be null", child2Model); + Assert.assertTrue("Model should be a BaseComponent", child2Model instanceof BaseComponent); + + final Resource extendedComponentResource = resolver.getResource(extendedComponentPath); + Assert.assertNotNull(extendedComponentResource); + final Object extendedModel = modelFactory.getModelFromResource(extendedComponentResource); + Assert.assertNotNull("Model should not be null", extendedModel); + Assert.assertTrue("Model should be a BaseComponent", extendedModel instanceof BaseComponent); + Assert.assertTrue("Model should be an ExtendedComponent", extendedModel instanceof ExtendedComponent); + } + } + + @Test + public void testClientModelCreateFromRequest() throws LoginException { + try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { + final Resource baseComponentResource = resolver.getResource(fromRequestComponentPath); + Assert.assertNotNull(baseComponentResource); + final Object baseModel = modelFactory.getModelFromRequest(new FakeRequest(baseComponentResource)); + Assert.assertNotNull("Model should not be null", baseModel); + Assert.assertTrue("Model should be a FromRequestComponent", baseModel instanceof FromRequestComponent); + } + } +} diff --git a/it/src/test/java/org/apache/sling/models/testing/rtboundpicker/ResourceTypePickerIT.java b/it/src/test/java/org/apache/sling/models/testing/rtboundpicker/ResourceTypePickerIT.java new file mode 100644 index 00000000..3faa6e98 --- /dev/null +++ b/it/src/test/java/org/apache/sling/models/testing/rtboundpicker/ResourceTypePickerIT.java @@ -0,0 +1,91 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.testing.rtboundpicker; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.sling.api.SlingConstants; +import org.apache.sling.api.resource.LoginException; +import org.apache.sling.api.resource.PersistenceException; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.ResourceUtil; +import org.apache.sling.junit.rules.TeleporterRule; +import org.apache.sling.models.it.rtboundpicker.BaseComponent; +import org.apache.sling.models.it.rtboundpicker.SubRTComponent; +import org.apache.sling.models.it.rtboundpicker.TestComponent; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +public class ResourceTypePickerIT { + + @Rule + public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "SM_Teleporter"); + + private ResourceResolverFactory rrFactory; + + private final String baseComponentPath = "/content/rtpicker/baseComponent"; + private final String childComponentPath = "/content/rtpicker/childComponent"; + + @Before + @SuppressWarnings("null") + public void setup() throws LoginException, PersistenceException { + rrFactory = teleporter.getService(ResourceResolverFactory.class); + try (ResourceResolver adminResolver = rrFactory.getServiceResourceResolver(null); ) { + Map properties = new HashMap(); + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, + "sling/rtpicker/base"); + ResourceUtil.getOrCreateResource(adminResolver, baseComponentPath, properties, null, false); + properties.clear(); + + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, + "sling/rtpicker/sub"); + properties.put( + SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_SUPER_TYPE, + "sling/rtpicker/base"); + ResourceUtil.getOrCreateResource(adminResolver, childComponentPath, properties, null, false); + properties.clear(); + + adminResolver.commit(); + } + } + + @Test + public void testClientModelCreateFromResource() throws LoginException { + try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { + final Resource baseComponentResource = resolver.getResource(baseComponentPath); + Assert.assertNotNull(baseComponentResource); + TestComponent baseModel = baseComponentResource.adaptTo(TestComponent.class); + Assert.assertNotNull("Model should not be null", baseModel); + Assert.assertTrue("Model should be a BaseComponent", baseModel instanceof BaseComponent); + + final Resource childComponentResource = resolver.getResource(childComponentPath); + Assert.assertNotNull(childComponentResource); + baseModel = childComponentResource.adaptTo(TestComponent.class); + Assert.assertNotNull("Model should not be null", baseModel); + Assert.assertTrue("Model should be a SubRTComponent", baseModel instanceof SubRTComponent); + } + } +} diff --git a/it/src/test/provisioning/sling-models-jacksonexporter.txt b/it/src/test/provisioning/sling-models-jacksonexporter.txt new file mode 100644 index 00000000..a2a903d1 --- /dev/null +++ b/it/src/test/provisioning/sling-models-jacksonexporter.txt @@ -0,0 +1,24 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# must be the same feature name as the feature defined in slingstart to allow merging +[feature name=models-jacksonexporter] + +[artifacts] + org.apache.sling/org.apache.sling.models.jacksonexporter diff --git a/it/src/test/provisioning/sling.txt b/it/src/test/provisioning/sling.txt new file mode 100644 index 00000000..d5d7e479 --- /dev/null +++ b/it/src/test/provisioning/sling.txt @@ -0,0 +1,50 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# must be the same feature name as the feature defined in slingstart to allow merging +[feature name=sling] + +[artifacts] + org.apache.sling/org.apache.sling.starter/11/slingstart + + # Update to newer bundles required by sling models impl + org.osgi/org.osgi.util.converter/1.0.9 + org.apache.sling/org.apache.sling.api/2.21.0 + org.apache.sling/org.apache.sling.resourceresolver/1.6.16 + org.apache.sling/org.apache.sling.servlets.resolver/2.5.8 + org.apache.sling/org.apache.sling.scripting.core/2.1.0 + + # Use versions as defined in POM + org.apache.sling/org.apache.sling.models.api + org.apache.sling/org.apache.sling.models.impl + + # Additional test bundles + org.apache.sling/org.apache.sling.junit.core + org.apache.sling/org.apache.sling.models.integration-tests + +[configurations] + # configure service user mapping for junit core (being used in the IT itself) + org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-junit + user.mapping=["org.apache.sling.junit.core\=models-it"] + +[:repoinit] + create service user models-it + set ACL for models-it + allow jcr:all on / + end diff --git a/pom.xml b/pom.xml index a7f30b43..df4c0dfc 100644 --- a/pom.xml +++ b/pom.xml @@ -35,5 +35,6 @@ parent impl + it From 046bb7a30ea790450e20c1eaa6d93aab187809ef Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Fri, 9 Jan 2026 15:49:31 +0100 Subject: [PATCH 03/16] align versions --- impl/pom.xml | 9 +-------- it/pom.xml | 31 +++++++------------------------ parent/pom.xml | 21 ++++++++++++--------- 3 files changed, 20 insertions(+), 41 deletions(-) diff --git a/impl/pom.xml b/impl/pom.xml index a5b3f73d..2ca44be7 100644 --- a/impl/pom.xml +++ b/impl/pom.xml @@ -32,13 +32,6 @@ Apache Sling Models Implementation Apache Sling Models Implementation - - scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-impl.git - scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-impl.git - org.apache.sling.models.impl-1.7.2 - https://github.com/apache/sling-org-apache-sling-models-impl.git - - 2025-08-27T03:14:05Z 17 @@ -48,7 +41,6 @@ org.apache.sling org.apache.sling.models.api - 2.0.0 provided @@ -213,6 +205,7 @@ provided + diff --git a/it/pom.xml b/it/pom.xml index 7e209ec9..319eade5 100644 --- a/it/pom.xml +++ b/it/pom.xml @@ -35,9 +35,9 @@ remote test proxy that runs in the integration-tests phase. - 8 - - false + 14-SNAPSHOT + 200 + 60 @@ -114,19 +114,18 @@ org.apache.sling org.apache.sling.models.api - 1.5.5-SNAPSHOT provided org.apache.sling org.apache.sling.models.impl - 1.7.3-SNAPSHOT + 2.0.1-SNAPSHOT provided org.apache.sling org.apache.sling.models.jacksonexporter - 1.1.5-SNAPSHOT + 2.0.1-SNAPSHOT provided @@ -144,13 +143,13 @@ org.apache.sling org.apache.sling.api - 2.18.4 + 3.0.0 provided org.apache.commons commons-lang3 - 3.8.1 + 3.18.0 provided @@ -225,20 +224,4 @@ - - - - debug-remote-process - - -Xmx512m -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=38080,suspend=n - - - - debug-remote-process-suspend - - -Xmx512m -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=38080,suspend=y - - - - diff --git a/parent/pom.xml b/parent/pom.xml index b6c772b5..5500b58c 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -40,16 +40,19 @@ - 2025-08-27T03:14:05Z 17 + 2025-08-27T03:14:05Z + 2.0.0 - - - org.apache.sling - org.apache.sling.models.api - 2.0.0 - provided - - + + + + org.apache.sling + org.apache.sling.models.api + ${models.api.version} + provided + + + From cb84b5925d58ca53c5fb1c52db187fe367b18aee Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Fri, 9 Jan 2026 16:57:48 +0100 Subject: [PATCH 04/16] switch to feature launcher --- impl/pom.xml | 2 - it/pom.xml | 167 +++++++++++++++++- it/src/main/features/launcher-repoinit.txt | 23 +++ it/src/main/features/launcher.json | 24 +++ .../customizers/SM_TeleporterCustomizer.java | 8 +- .../models/testing/exporter/ExporterIT.java | 5 +- parent/pom.xml | 2 +- 7 files changed, 216 insertions(+), 15 deletions(-) create mode 100644 it/src/main/features/launcher-repoinit.txt create mode 100644 it/src/main/features/launcher.json diff --git a/impl/pom.xml b/impl/pom.xml index 2ca44be7..a338e039 100644 --- a/impl/pom.xml +++ b/impl/pom.xml @@ -83,13 +83,11 @@ javax.servlet javax.servlet-api - 4.0.1 provided jakarta.servlet jakarta.servlet-api - 6.0.0 provided diff --git a/it/pom.xml b/it/pom.xml index 319eade5..c30ec8e8 100644 --- a/it/pom.xml +++ b/it/pom.xml @@ -78,19 +78,19 @@ org.apache.sling org.apache.sling.junit.core - 1.0.28 + 1.2.0 provided org.apache.sling org.apache.sling.testing.rules - 1.0.8 + 2.0.2 test org.apache.sling org.apache.sling.testing.clients - 2.0.12 + 3.1.0 test @@ -102,13 +102,13 @@ org.apache.sling org.apache.sling.junit.teleporter - 1.0.20 + 1.1.0 test org.apache.sling org.apache.sling.engine - 2.6.14 + 3.0.0 provided @@ -135,6 +135,11 @@ javax.servlet-api provided + + jakarta.servlet + jakarta.servlet-api + provided + javax.jcr jcr @@ -174,6 +179,12 @@ annotations provided + + org.apache.sling + org.apache.sling.commons.johnzon + 2.0.0 + provided + org.slf4j slf4j-simple @@ -195,6 +206,7 @@ + biz.aQute.bnd bnd-maven-plugin @@ -206,6 +218,7 @@ + biz.aQute.bnd bnd-baseline-maven-plugin @@ -213,6 +226,7 @@ true + org.apache.rat apache-rat-plugin @@ -222,6 +236,149 @@ + + + org.codehaus.mojo + build-helper-maven-plugin + + + reserve-network-port + + reserve-network-port + + initialize + + + http.port + + + + + + + + org.apache.sling + slingfeature-maven-plugin + 1.9.2 + true + + + models.api.version + true + + + app + *.json + + ${http.port} + + + org.apache.sling:org.apache.sling.models.api:HIGHEST + org.apache.sling:org.apache.sling.models.impl:HIGHEST + + + org.apache.sling + org.apache.sling.starter + nosample_base + ${sling.starter.version} + slingosgifeature + + + org.apache.sling + org.apache.sling.starter + oak_persistence_sns + ${sling.starter.version} + slingosgifeature + + + org.apache.sling + org.apache.sling.starter + junit + ${sling.starter.version} + slingosgifeature + + + + + + app + + + + + + prepare-features + + aggregate-features + analyse-features + attach-features + + prepare-package + + + + + + org.apache.sling + feature-launcher-maven-plugin + 1.0.1-SNAPSHOT + + + + sling-starter-oak-tar + + org.apache.sling + org.apache.sling.models.impl.it + ${project.version} + app + slingosgifeature + + + + --add-opens java.base/java.lang=ALL-UNNAMED + + + ${http.port} + 5000000 + + + ${it.startTimeoutSeconds} + + + + + + launcher-start + + start + stop + + + + + + + maven-failsafe-plugin + + + http://localhost:${http.port} + false:${http.port} + ${starter.min.bundles.count} + + /system/console/bundles, + + + + + integration-test + + integration-test + verify + + + + + diff --git a/it/src/main/features/launcher-repoinit.txt b/it/src/main/features/launcher-repoinit.txt new file mode 100644 index 00000000..7d361180 --- /dev/null +++ b/it/src/main/features/launcher-repoinit.txt @@ -0,0 +1,23 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +create service user models-it +set ACL for models-it + allow jcr:all on / +end \ No newline at end of file diff --git a/it/src/main/features/launcher.json b/it/src/main/features/launcher.json new file mode 100644 index 00000000..1bc8d0f4 --- /dev/null +++ b/it/src/main/features/launcher.json @@ -0,0 +1,24 @@ +{ + "bundles": [ + { + "id": "org.apache.sling/org.apache.sling.models.api/${models.api.version}", + "start-order": 20 + }, + { + "id": "org.apache.sling/org.apache.sling.models.impl/${project.version}", + "start-order": 20 + }, + { + "id": "org.apache.sling/org.apache.sling.models.impl.it/${project.version}", + "start-order": 20 + } + ], + "configurations": { + "org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended~junit": { + "user.mapping": [ + "org.apache.sling.junit.core=models-it" + ] + } + }, + "repoinit:TEXT|true": "@file" +} \ No newline at end of file diff --git a/it/src/test/java/org/apache/sling/junit/teleporter/customizers/SM_TeleporterCustomizer.java b/it/src/test/java/org/apache/sling/junit/teleporter/customizers/SM_TeleporterCustomizer.java index 22efc011..6cf082ab 100644 --- a/it/src/test/java/org/apache/sling/junit/teleporter/customizers/SM_TeleporterCustomizer.java +++ b/it/src/test/java/org/apache/sling/junit/teleporter/customizers/SM_TeleporterCustomizer.java @@ -18,6 +18,7 @@ */ package org.apache.sling.junit.teleporter.customizers; +import java.io.IOException; import java.net.URI; import java.util.concurrent.TimeoutException; @@ -48,13 +49,12 @@ public void customize(TeleporterRule t, String options) { cst.includeDependencyPrefix("org.apache.sling.models.testing"); // additionally check for the registration of mandatory sling models components - try { - OsgiConsoleClient osgiClient = new OsgiConsoleClient( - URI.create(S.getServerBaseUrl()), S.getServerUsername(), S.getServerPassword()); + try (OsgiConsoleClient osgiClient = + new OsgiConsoleClient(URI.create(S.getServerBaseUrl()), S.getServerUsername(), S.getServerPassword())) { for (Class clazz : EXPECTED_COMPONENTS) { osgiClient.waitComponentRegistered(clazz.getName(), 20000, 200); } - } catch (ClientException | TimeoutException | InterruptedException ex) { + } catch (ClientException | TimeoutException | InterruptedException | IOException ex) { throw new RuntimeException("Error waiting for expected components.", ex); } } diff --git a/it/src/test/java/org/apache/sling/models/testing/exporter/ExporterIT.java b/it/src/test/java/org/apache/sling/models/testing/exporter/ExporterIT.java index 4dae2767..beb0ae93 100644 --- a/it/src/test/java/org/apache/sling/models/testing/exporter/ExporterIT.java +++ b/it/src/test/java/org/apache/sling/models/testing/exporter/ExporterIT.java @@ -18,9 +18,6 @@ */ package org.apache.sling.models.testing.exporter; -import javax.json.Json; -import javax.json.JsonObject; - import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.StringReader; @@ -31,6 +28,8 @@ import java.util.Map; import java.util.TimeZone; +import jakarta.json.Json; +import jakarta.json.JsonObject; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.FastDateFormat; import org.apache.sling.api.SlingConstants; diff --git a/parent/pom.xml b/parent/pom.xml index 5500b58c..b2bf6aa1 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -23,7 +23,7 @@ org.apache.sling sling-bundle-parent - 62 + 65 From 87ba6130e954016a936df16a58f06107ebe5272f Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Fri, 9 Jan 2026 17:37:03 +0100 Subject: [PATCH 05/16] remove models exporter tests from this repo --- it/pom.xml | 24 +- .../models/it/exporter/BaseComponent.java | 59 --- .../it/exporter/BaseRequestComponent.java | 101 ------ .../sling/models/it/exporter/Component.java | 26 -- .../models/it/exporter/ComponentImpl.java | 50 --- .../it/exporter/DoubledFirstComponent.java | 34 -- .../it/exporter/DoubledSecondComponent.java | 34 -- .../models/it/exporter/ExtendedComponent.java | 53 --- .../it/exporter/ExtendedRequestComponent.java | 59 --- .../it/exporter/RequestComponentImpl.java | 59 --- .../models/it/exporter/package-info.java | 21 -- .../customizers/SM_TeleporterCustomizer.java | 3 +- .../models/testing/exporter/ExporterIT.java | 343 ------------------ 13 files changed, 7 insertions(+), 859 deletions(-) delete mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/BaseComponent.java delete mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/BaseRequestComponent.java delete mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/Component.java delete mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/ComponentImpl.java delete mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/DoubledFirstComponent.java delete mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/DoubledSecondComponent.java delete mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/ExtendedComponent.java delete mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/ExtendedRequestComponent.java delete mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/RequestComponentImpl.java delete mode 100644 it/src/main/java/org/apache/sling/models/it/exporter/package-info.java delete mode 100644 it/src/test/java/org/apache/sling/models/testing/exporter/ExporterIT.java diff --git a/it/pom.xml b/it/pom.xml index c30ec8e8..7476e242 100644 --- a/it/pom.xml +++ b/it/pom.xml @@ -107,24 +107,24 @@ org.apache.sling - org.apache.sling.engine - 3.0.0 + org.apache.sling.commons.johnzon + 2.0.0 provided org.apache.sling - org.apache.sling.models.api + org.apache.sling.engine + 3.0.0 provided org.apache.sling - org.apache.sling.models.impl - 2.0.1-SNAPSHOT + org.apache.sling.models.api provided org.apache.sling - org.apache.sling.models.jacksonexporter + org.apache.sling.models.impl 2.0.1-SNAPSHOT provided @@ -157,12 +157,6 @@ 3.18.0 provided - - com.fasterxml.jackson.core - jackson-annotations - 2.9.7 - provided - org.apache.geronimo.specs geronimo-atinject_1.0_spec @@ -179,12 +173,6 @@ annotations provided - - org.apache.sling - org.apache.sling.commons.johnzon - 2.0.0 - provided - org.slf4j slf4j-simple diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/BaseComponent.java b/it/src/main/java/org/apache/sling/models/it/exporter/BaseComponent.java deleted file mode 100644 index c772d96d..00000000 --- a/it/src/main/java/org/apache/sling/models/it/exporter/BaseComponent.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.sling.models.it.exporter; - -import javax.inject.Inject; - -import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.sling.api.resource.Resource; -import org.apache.sling.models.annotations.Exporter; -import org.apache.sling.models.annotations.Model; - -@Model( - adaptables = {Resource.class}, - resourceType = "sling/exp/base") -@Exporter(name = "jackson", extensions = "json") -public class BaseComponent { - - private final Resource resource; - - @Inject - private String sampleValue; - - public BaseComponent(Resource resource) { - this.resource = resource; - } - - public String getId() { - return this.resource.getPath(); - } - - public String getSampleValue() { - return sampleValue; - } - - @JsonProperty(value = "UPPER") - public String getSampleValueToUpperCase() { - return sampleValue.toUpperCase(); - } - - public Resource getResource() { - return resource; - } -} diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/BaseRequestComponent.java b/it/src/main/java/org/apache/sling/models/it/exporter/BaseRequestComponent.java deleted file mode 100644 index 6aa54055..00000000 --- a/it/src/main/java/org/apache/sling/models/it/exporter/BaseRequestComponent.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.sling.models.it.exporter; - -import javax.inject.Inject; -import javax.servlet.ServletRequest; -import javax.servlet.http.HttpServletRequest; - -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.sling.api.SlingHttpServletRequest; -import org.apache.sling.api.resource.Resource; -import org.apache.sling.models.annotations.Exporter; -import org.apache.sling.models.annotations.ExporterOption; -import org.apache.sling.models.annotations.Model; -import org.apache.sling.models.annotations.Via; -import org.apache.sling.models.annotations.injectorspecific.SlingObject; - -@Model( - adaptables = {SlingHttpServletRequest.class}, - resourceType = "sling/exp-request/base") -@Exporter( - name = "jackson", - extensions = "json", - options = {@ExporterOption(name = "MapperFeature.SORT_PROPERTIES_ALPHABETICALLY", value = "true")}) -public class BaseRequestComponent { - - @Inject - @SlingObject - private Resource resource; - - @Inject - @Via("resource") - private String sampleValue; - - @Inject - private Map testBindingsObject; - - @Inject - private Map testBindingsObject2; - - private final SlingHttpServletRequest request; - - public BaseRequestComponent(SlingHttpServletRequest request) { - this.request = request; - } - - public String getId() { - return this.resource.getPath(); - } - - public String getSampleValue() { - return sampleValue; - } - - @JsonProperty(value = "UPPER") - public String getSampleValueToUpperCase() { - return sampleValue.toUpperCase(); - } - - public Resource getResource() { - return resource; - } - - public Map getTestBindingsObject() { - return testBindingsObject; - } - - public Map getTestBindingsObject2() { - return testBindingsObject2; - } - - public SlingHttpServletRequest getSlingHttpServletRequest() { - return request; - } - - public HttpServletRequest getHttpServletRequest() { - return request; - } - - public ServletRequest getServletRequest() { - return request; - } -} diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/Component.java b/it/src/main/java/org/apache/sling/models/it/exporter/Component.java deleted file mode 100644 index d90f5a2c..00000000 --- a/it/src/main/java/org/apache/sling/models/it/exporter/Component.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.sling.models.it.exporter; - -public interface Component { - - String getId(); - - String getSampleValue(); -} diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/ComponentImpl.java b/it/src/main/java/org/apache/sling/models/it/exporter/ComponentImpl.java deleted file mode 100644 index 4d0deb9a..00000000 --- a/it/src/main/java/org/apache/sling/models/it/exporter/ComponentImpl.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.sling.models.it.exporter; - -import javax.inject.Inject; - -import org.apache.sling.api.resource.Resource; -import org.apache.sling.models.annotations.Exporter; -import org.apache.sling.models.annotations.Model; - -@Model( - adaptables = {Resource.class}, - adapters = Component.class, - resourceType = "sling/exp/interface") -@Exporter(name = "jackson", extensions = "json") -public class ComponentImpl implements Component { - - private final Resource resource; - - @Inject - private String sampleValue; - - public ComponentImpl(Resource resource) { - this.resource = resource; - } - - public String getId() { - return this.resource.getPath(); - } - - public String getSampleValue() { - return sampleValue; - } -} diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/DoubledFirstComponent.java b/it/src/main/java/org/apache/sling/models/it/exporter/DoubledFirstComponent.java deleted file mode 100644 index 84b0289a..00000000 --- a/it/src/main/java/org/apache/sling/models/it/exporter/DoubledFirstComponent.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.sling.models.it.exporter; - -import org.apache.sling.api.resource.Resource; -import org.apache.sling.models.annotations.Exporter; -import org.apache.sling.models.annotations.Model; - -@Model( - adaptables = {Resource.class}, - resourceType = "sling/exp/doubled") -@Exporter(name = "jackson", extensions = "json", selector = "firstmodel") -public class DoubledFirstComponent { - - public String getValue() { - return "first"; - } -} diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/DoubledSecondComponent.java b/it/src/main/java/org/apache/sling/models/it/exporter/DoubledSecondComponent.java deleted file mode 100644 index bbc118cb..00000000 --- a/it/src/main/java/org/apache/sling/models/it/exporter/DoubledSecondComponent.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.sling.models.it.exporter; - -import org.apache.sling.api.resource.Resource; -import org.apache.sling.models.annotations.Exporter; -import org.apache.sling.models.annotations.Model; - -@Model( - adaptables = {Resource.class}, - resourceType = "sling/exp/doubled") -@Exporter(name = "jackson", extensions = "json", selector = "secondmodel") -public class DoubledSecondComponent { - - public String getValue() { - return "second"; - } -} diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/ExtendedComponent.java b/it/src/main/java/org/apache/sling/models/it/exporter/ExtendedComponent.java deleted file mode 100644 index ff0bd7f2..00000000 --- a/it/src/main/java/org/apache/sling/models/it/exporter/ExtendedComponent.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.sling.models.it.exporter; - -import javax.inject.Inject; - -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; - -import org.apache.sling.api.resource.Resource; -import org.apache.sling.models.annotations.Exporter; -import org.apache.sling.models.annotations.Model; - -@Model( - adaptables = {Resource.class}, - resourceType = "sling/exp/extended") -@Exporter(name = "jackson", extensions = "json") -public class ExtendedComponent extends BaseComponent { - - @Inject - private Date date; - - public ExtendedComponent(Resource resource) { - super(resource); - } - - public Calendar getDateByCalendar() { - Calendar cal = new GregorianCalendar(); - cal.setTime(date); - return cal; - } - - public Date getDate() { - return date; - } -} diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/ExtendedRequestComponent.java b/it/src/main/java/org/apache/sling/models/it/exporter/ExtendedRequestComponent.java deleted file mode 100644 index 492486db..00000000 --- a/it/src/main/java/org/apache/sling/models/it/exporter/ExtendedRequestComponent.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.sling.models.it.exporter; - -import javax.inject.Inject; - -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; - -import org.apache.sling.api.SlingHttpServletRequest; -import org.apache.sling.models.annotations.Exporter; -import org.apache.sling.models.annotations.ExporterOption; -import org.apache.sling.models.annotations.Model; -import org.apache.sling.models.annotations.Via; - -@Model( - adaptables = {SlingHttpServletRequest.class}, - resourceType = "sling/exp-request/extended") -@Exporter( - name = "jackson", - extensions = "json", - options = {@ExporterOption(name = "SerializationFeature.WRITE_DATES_AS_TIMESTAMPS", value = "false")}) -public class ExtendedRequestComponent extends BaseRequestComponent { - - @Inject - @Via("resource") - private Date date; - - public ExtendedRequestComponent(SlingHttpServletRequest request) { - super(request); - } - - public Calendar getDateByCalendar() { - Calendar cal = new GregorianCalendar(); - cal.setTime(date); - return cal; - } - - public Date getDate() { - return date; - } -} diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/RequestComponentImpl.java b/it/src/main/java/org/apache/sling/models/it/exporter/RequestComponentImpl.java deleted file mode 100644 index 2ffe7e6c..00000000 --- a/it/src/main/java/org/apache/sling/models/it/exporter/RequestComponentImpl.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.sling.models.it.exporter; - -import javax.inject.Inject; - -import org.apache.sling.api.SlingHttpServletRequest; -import org.apache.sling.api.resource.Resource; -import org.apache.sling.models.annotations.Exporter; -import org.apache.sling.models.annotations.Model; -import org.apache.sling.models.annotations.Via; -import org.apache.sling.models.annotations.injectorspecific.SlingObject; - -@Model( - adaptables = {SlingHttpServletRequest.class}, - adapters = Component.class, - resourceType = "sling/exp-request/interface") -@Exporter(name = "jackson", extensions = "json") -public class RequestComponentImpl implements Component { - - @Inject - @SlingObject - private Resource resource; - - @Inject - @Via("resource") - private String sampleValue; - - @SuppressWarnings("unused") - private final SlingHttpServletRequest request; - - public RequestComponentImpl(SlingHttpServletRequest request) { - this.request = request; - } - - public String getId() { - return this.resource.getPath(); - } - - public String getSampleValue() { - return sampleValue; - } -} diff --git a/it/src/main/java/org/apache/sling/models/it/exporter/package-info.java b/it/src/main/java/org/apache/sling/models/it/exporter/package-info.java deleted file mode 100644 index d6273ab4..00000000 --- a/it/src/main/java/org/apache/sling/models/it/exporter/package-info.java +++ /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. - */ - -@Version("1.0") -package org.apache.sling.models.it.exporter; - -import org.osgi.annotation.versioning.Version; diff --git a/it/src/test/java/org/apache/sling/junit/teleporter/customizers/SM_TeleporterCustomizer.java b/it/src/test/java/org/apache/sling/junit/teleporter/customizers/SM_TeleporterCustomizer.java index 6cf082ab..ed041054 100644 --- a/it/src/test/java/org/apache/sling/junit/teleporter/customizers/SM_TeleporterCustomizer.java +++ b/it/src/test/java/org/apache/sling/junit/teleporter/customizers/SM_TeleporterCustomizer.java @@ -24,7 +24,6 @@ import org.apache.sling.junit.rules.TeleporterRule; import org.apache.sling.models.impl.ModelAdapterFactory; -import org.apache.sling.models.jacksonexporter.impl.JacksonExporter; import org.apache.sling.testing.clients.ClientException; import org.apache.sling.testing.clients.osgi.OsgiConsoleClient; import org.apache.sling.testing.serversetup.instance.SlingTestBase; @@ -38,7 +37,7 @@ public class SM_TeleporterCustomizer implements TeleporterRule.Customizer { private static final SlingTestBase S = new SlingTestBase(); - private static final Class[] EXPECTED_COMPONENTS = new Class[] {ModelAdapterFactory.class, JacksonExporter.class}; + private static final Class[] EXPECTED_COMPONENTS = new Class[] {ModelAdapterFactory.class}; @Override public void customize(TeleporterRule t, String options) { diff --git a/it/src/test/java/org/apache/sling/models/testing/exporter/ExporterIT.java b/it/src/test/java/org/apache/sling/models/testing/exporter/ExporterIT.java deleted file mode 100644 index beb0ae93..00000000 --- a/it/src/test/java/org/apache/sling/models/testing/exporter/ExporterIT.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.sling.models.testing.exporter; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.StringReader; -import java.text.Format; -import java.util.Calendar; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.TimeZone; - -import jakarta.json.Json; -import jakarta.json.JsonObject; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.time.FastDateFormat; -import org.apache.sling.api.SlingConstants; -import org.apache.sling.api.resource.Resource; -import org.apache.sling.api.resource.ResourceResolver; -import org.apache.sling.api.resource.ResourceResolverFactory; -import org.apache.sling.api.resource.ResourceUtil; -import org.apache.sling.engine.SlingRequestProcessor; -import org.apache.sling.junit.rules.TeleporterRule; -import org.apache.sling.models.factory.MissingExporterException; -import org.apache.sling.models.factory.ModelFactory; -import org.apache.sling.models.testing.helper.FakeRequest; -import org.apache.sling.models.testing.helper.FakeResponse; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; - -public class ExporterIT { - - @Rule - public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "SM_Teleporter"); - - private ResourceResolverFactory rrFactory; - - private ModelFactory modelFactory; - - private SlingRequestProcessor slingRequestProcessor; - - private final String baseComponentPath = "/content/exp/baseComponent"; - private final String doubledComponentPath = "/content/exp/doubledComponent"; - private final String childComponentPath = "/content/exp/childComponent"; - private final String extendedComponentPath = "/content/exp/extendedComponent"; - private final String interfaceComponentPath = "/content/exp/interfaceComponent"; - private final String baseRequestComponentPath = "/content/exp-request/baseComponent"; - private final String extendedRequestComponentPath = "/content/exp-request/extendedComponent"; - private final String interfaceRequestComponentPath = "/content/exp-request/interfaceComponent"; - private Calendar testDate; - - private Format dateFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSSZ", TimeZone.getTimeZone("UTC")); - - @Before - @SuppressWarnings("null") - public void setup() throws Exception { - rrFactory = teleporter.getService(ResourceResolverFactory.class); - modelFactory = teleporter.getService(ModelFactory.class); - slingRequestProcessor = teleporter.getService(SlingRequestProcessor.class); - - try (ResourceResolver adminResolver = rrFactory.getServiceResourceResolver(null); ) { - Map properties = new HashMap(); - properties.put("sampleValue", "baseTESTValue"); - properties.put("sampleBooleanValue", true); - properties.put("sampleLongValue", 1l); - properties.put("sampleDoubleValue", 1d); - properties.put("sampleArray", new String[] {"a", "b", "c"}); - properties.put("sampleEmptyArray", new String[0]); - properties.put("sampleBinary", new ByteArrayInputStream("abc".getBytes("UTF-8"))); - properties.put("sampleBinaryArray", new InputStream[] { - new ByteArrayInputStream("abc".getBytes("UTF-8")), new ByteArrayInputStream("def".getBytes("UTF-8")) - }); - properties.put( - SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, "sling/exp/base"); - ResourceUtil.getOrCreateResource(adminResolver, baseComponentPath, properties, null, false); - - ResourceUtil.getOrCreateResource( - adminResolver, baseComponentPath + "/child", Collections.emptyMap(), null, false); - - properties.put( - SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, - "sling/exp-request/base"); - ResourceUtil.getOrCreateResource(adminResolver, baseRequestComponentPath, properties, null, false); - properties.clear(); - - properties.put("sampleValue", "childTESTValue"); - properties.put( - SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, "sling/exp/child"); - properties.put( - SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_SUPER_TYPE, - "sling/exp/base"); - ResourceUtil.getOrCreateResource(adminResolver, childComponentPath, properties, null, false); - properties.clear(); - - properties.put("sampleValue", "extendedTESTValue"); - properties.put( - SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, - "sling/exp/extended"); - testDate = Calendar.getInstance(); - testDate.setTimeZone(TimeZone.getTimeZone("UTC")); - testDate.setTimeInMillis(0); - testDate.set(2015, 6, 29); - properties.put("date", testDate); - ResourceUtil.getOrCreateResource(adminResolver, extendedComponentPath, properties, null, false); - - properties.put( - SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, - "sling/exp-request/extended"); - ResourceUtil.getOrCreateResource(adminResolver, extendedRequestComponentPath, properties, null, false); - properties.clear(); - - properties.put("sampleValue", "interfaceTESTValue"); - properties.put( - SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, - "sling/exp/interface"); - ResourceUtil.getOrCreateResource(adminResolver, interfaceComponentPath, properties, null, false); - - properties.put( - SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, - "sling/exp-request/interface"); - ResourceUtil.getOrCreateResource(adminResolver, interfaceRequestComponentPath, properties, null, false); - properties.clear(); - - properties.put( - SlingConstants.NAMESPACE_PREFIX + ":" + SlingConstants.PROPERTY_RESOURCE_TYPE, "sling/exp/doubled"); - ResourceUtil.getOrCreateResource(adminResolver, doubledComponentPath, properties, null, false); - - adminResolver.commit(); - } - } - - @Test - @SuppressWarnings("null") - public void testExportToJSON() throws Exception { - try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { - final Resource baseComponentResource = resolver.getResource(baseComponentPath); - Assert.assertNotNull(baseComponentResource); - String jsonData = modelFactory.exportModelForResource( - baseComponentResource, "jackson", String.class, Collections.emptyMap()); - Assert.assertTrue( - "JSON Data should contain the property value", StringUtils.contains(jsonData, "baseTESTValue")); - - JsonObject parsed = Json.createReader(new StringReader(jsonData)).readObject(); - JsonObject resource = parsed.getJsonObject("resource"); - Assert.assertEquals(3, resource.getJsonArray("sampleArray").size()); - Assert.assertEquals( - 1.0d, resource.getJsonNumber("sampleDoubleValue").doubleValue(), .1); - Assert.assertEquals(2, resource.getJsonArray(":sampleBinaryArray").size()); - Assert.assertTrue(resource.getBoolean("sampleBooleanValue")); - Assert.assertEquals(1, resource.getInt("sampleLongValue")); - Assert.assertEquals(3, resource.getInt(":sampleBinary")); - Assert.assertEquals(0, resource.getJsonArray("sampleEmptyArray").size()); - - final Resource extendedComponentResource = resolver.getResource(extendedComponentPath); - Assert.assertNotNull(extendedComponentResource); - jsonData = modelFactory.exportModelForResource( - extendedComponentResource, "jackson", String.class, Collections.emptyMap()); - Assert.assertTrue( - "JSON Data should contain the property value", StringUtils.contains(jsonData, "extendedTESTValue")); - - final Resource interfaceComponentResource = resolver.getResource(interfaceComponentPath); - Assert.assertNotNull(baseComponentResource); - jsonData = modelFactory.exportModelForResource( - interfaceComponentResource, "jackson", String.class, Collections.emptyMap()); - Assert.assertTrue( - "JSON Data should contain the property value", - StringUtils.contains(jsonData, "interfaceTESTValue")); - } - } - - @Test - public void testExportToTidyJSON() throws Exception { - try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { - final Resource baseComponentResource = resolver.getResource(baseComponentPath); - Assert.assertNotNull(baseComponentResource); - String jsonData = modelFactory.exportModelForResource( - baseComponentResource, "jackson", String.class, Collections.emptyMap()); - Assert.assertFalse(jsonData.contains(System.lineSeparator())); - - jsonData = modelFactory.exportModelForResource( - baseComponentResource, - "jackson", - String.class, - Collections.singletonMap("tidy", "true")); - Assert.assertTrue(jsonData.contains(System.lineSeparator())); - } - } - - @SuppressWarnings("unchecked") - @Test - public void testExportToMap() throws Exception { - try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { - final Resource baseComponentResource = resolver.getResource(baseComponentPath); - Assert.assertNotNull(baseComponentResource); - Map data = modelFactory.exportModelForResource( - baseComponentResource, "jackson", Map.class, Collections.emptyMap()); - Assert.assertEquals("Should have resource value", "baseTESTValue", data.get("sampleValue")); - Assert.assertEquals("Should have resource value", "BASETESTVALUE", data.get("UPPER")); - } - } - - @Test - public void testResourceServlets() throws Exception { - try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { - FakeResponse response = new FakeResponse(); - slingRequestProcessor.processRequest( - new FakeRequest(baseComponentPath + ".model.json"), response, resolver); - JsonObject obj = Json.createReader( - new StringReader((response.getStringWriter().toString()))) - .readObject(); - Assert.assertEquals("application/json", response.getContentType()); - Assert.assertEquals("UTF-8", response.getCharacterEncoding()); - Assert.assertEquals("BASETESTVALUE", obj.getString("UPPER")); - Assert.assertEquals(baseComponentPath, obj.getString("id")); - - response = new FakeResponse(); - slingRequestProcessor.processRequest( - new FakeRequest(extendedComponentPath + ".model.json"), response, resolver); - obj = Json.createReader(new StringReader((response.getStringWriter().toString()))) - .readObject(); - Assert.assertEquals("application/json", response.getContentType()); - Assert.assertEquals("UTF-8", response.getCharacterEncoding()); - Assert.assertEquals(extendedComponentPath, obj.getString("id")); - Assert.assertEquals( - testDate.getTimeInMillis(), obj.getJsonNumber("date").longValue()); - - response = new FakeResponse(); - slingRequestProcessor.processRequest( - new FakeRequest(interfaceComponentPath + ".model.json"), response, resolver); - obj = Json.createReader(new StringReader((response.getStringWriter().toString()))) - .readObject(); - Assert.assertEquals("application/json", response.getContentType()); - Assert.assertEquals("UTF-8", response.getCharacterEncoding()); - Assert.assertEquals(interfaceComponentPath, obj.getString("id")); - Assert.assertEquals("interfaceTESTValue", obj.getString("sampleValue")); - } - } - - @Test - public void testRequestServlets() throws Exception { - try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { - FakeResponse response = new FakeResponse(); - slingRequestProcessor.processRequest( - new FakeRequest(baseRequestComponentPath + ".model.json"), response, resolver); - String stringOutput = response.getStringWriter().toString(); - - Assert.assertTrue(stringOutput.startsWith("{\"UPPER\":")); - - JsonObject obj = Json.createReader(new StringReader(stringOutput)).readObject(); - Assert.assertEquals("application/json", response.getContentType()); - Assert.assertEquals("UTF-8", response.getCharacterEncoding()); - Assert.assertEquals("BASETESTVALUE", obj.getString("UPPER")); - Assert.assertTrue(obj.containsKey("testBindingsObject")); - JsonObject testBindingsObject = obj.getJsonObject("testBindingsObject"); - Assert.assertEquals("value", testBindingsObject.getString("name")); - Assert.assertTrue(obj.containsKey("testBindingsObject2")); - JsonObject testBindingsObject2 = obj.getJsonObject("testBindingsObject2"); - Assert.assertEquals("value2", testBindingsObject2.getString("name2")); - Assert.assertEquals(baseRequestComponentPath, obj.getString("id")); - - response = new FakeResponse(); - slingRequestProcessor.processRequest( - new FakeRequest(extendedRequestComponentPath + ".model.json"), response, resolver); - obj = Json.createReader(new StringReader((response.getStringWriter().toString()))) - .readObject(); - Assert.assertEquals("application/json", response.getContentType()); - Assert.assertEquals("UTF-8", response.getCharacterEncoding()); - Assert.assertEquals(extendedRequestComponentPath, obj.getString("id")); - Assert.assertEquals(dateFormat.format(testDate), obj.getString("date")); - - response = new FakeResponse(); - slingRequestProcessor.processRequest( - new FakeRequest(interfaceRequestComponentPath + ".model.json"), response, resolver); - obj = Json.createReader(new StringReader((response.getStringWriter().toString()))) - .readObject(); - Assert.assertEquals("application/json", response.getContentType()); - Assert.assertEquals("UTF-8", response.getCharacterEncoding()); - Assert.assertEquals(interfaceRequestComponentPath, obj.getString("id")); - Assert.assertEquals("interfaceTESTValue", obj.getString("sampleValue")); - } - } - - @Test - public void testDoubledServlets() throws Exception { - try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { - FakeResponse response = new FakeResponse(); - slingRequestProcessor.processRequest( - new FakeRequest(doubledComponentPath + ".firstmodel.json"), response, resolver); - - JsonObject obj = Json.createReader( - new StringReader((response.getStringWriter().toString()))) - .readObject(); - Assert.assertEquals("application/json", response.getContentType()); - Assert.assertEquals("first", obj.getString("value")); - - response = new FakeResponse(); - slingRequestProcessor.processRequest( - new FakeRequest(doubledComponentPath + ".secondmodel.json"), response, resolver); - obj = Json.createReader(new StringReader((response.getStringWriter().toString()))) - .readObject(); - Assert.assertEquals("application/json", response.getContentType()); - Assert.assertEquals("second", obj.getString("value")); - } - } - - @Test - public void testFailedExport() throws Exception { - boolean thrown = false; - try { - try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { - final Resource baseComponentResource = resolver.getResource(baseComponentPath); - Assert.assertNotNull(baseComponentResource); - modelFactory.exportModelForResource( - baseComponentResource, "jaxb", String.class, Collections.emptyMap()); - Assert.fail("Should have thrown missing serializer error."); - } - } catch (MissingExporterException e) { - thrown = true; - Assert.assertEquals("No exporter named jaxb supports java.lang.String.", e.getMessage()); - } - Assert.assertTrue(thrown); - } -} From a4d9e6f6ec29e1e3127edf9861237d922b0cef2a Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Fri, 9 Jan 2026 18:30:14 +0100 Subject: [PATCH 06/16] add IT debug profile --- it/pom.xml | 21 ++++++++++++++++++++- it/src/main/features/launcher.json | 8 +++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/it/pom.xml b/it/pom.xml index 7476e242..00c99c9b 100644 --- a/it/pom.xml +++ b/it/pom.xml @@ -38,6 +38,7 @@ 14-SNAPSHOT 200 60 + info @@ -251,7 +252,7 @@ true - models.api.version + models.api.version,models.log.level true @@ -369,4 +370,22 @@ + + + + + debug + + 8080 + true + debug + + + + diff --git a/it/src/main/features/launcher.json b/it/src/main/features/launcher.json index 1bc8d0f4..cafa8a0c 100644 --- a/it/src/main/features/launcher.json +++ b/it/src/main/features/launcher.json @@ -14,10 +14,16 @@ } ], "configurations": { - "org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended~junit": { + "org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended~integration-tests": { "user.mapping": [ "org.apache.sling.junit.core=models-it" ] + }, + "org.apache.sling.commons.log.LogManager.factory.config~integration-tests": { + "org.apache.sling.commons.log.names": [ + "org.apache.sling.models" + ], + "org.apache.sling.commons.log.level": "${models.log.level}" } }, "repoinit:TEXT|true": "@file" From 88e137d1cec0aea929bbf860f9518ee76e77cc22 Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Fri, 9 Jan 2026 18:41:36 +0100 Subject: [PATCH 07/16] use install instead of verify goal to be able to load models bundle snapshot in feature launcher --- .sling-module.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.sling-module.json b/.sling-module.json index cfad4d23..12dc84ba 100644 --- a/.sling-module.json +++ b/.sling-module.json @@ -1,5 +1,6 @@ { "jenkins": { - "jdks": [17, 21] + "jdks": [17, 21], + "mavenGoal": "install" } } \ No newline at end of file From 9391ab48c5925a1184ba6e33e02ba5016c74c327 Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Fri, 9 Jan 2026 19:24:07 +0100 Subject: [PATCH 08/16] split test models and integration tests in two modules --- it/{ => integration-tests}/bnd.bnd | 0 it/{ => integration-tests}/pom.xml | 79 ++------- .../src/main/features/launcher-repoinit.txt | 0 .../src/main/features/launcher.json | 2 +- .../customizers/SM_TeleporterCustomizer.java | 0 .../sling/models/testing/DecoratedIT.java | 0 .../models/testing/ImplementsExtendsIT.java | 0 .../testing/InjectorSpecificAnnotationIT.java | 0 .../models/testing/ModelFactorySimpleIT.java | 0 .../models/testing/PathBoundServletIT.java | 0 ...erviceInjectionWithDifferentRankingIT.java | 0 .../apache/sling/models/testing/SimpleIT.java | 0 .../apache/sling/models/testing/ViaIT.java | 0 .../testing/delegate/DelegateRequestIT.java | 0 .../testing/delegate/DelegateResourceIT.java | 0 .../ViaOriginalResourceDelegationIT.java | 0 .../models/testing/helper/FakeRequest.java | 0 .../models/testing/helper/FakeResponse.java | 0 .../models/testing/rtbound/FakeRequest.java | 0 .../rtbound/ResourceTypeBindingIT.java | 0 .../rtboundpicker/ResourceTypePickerIT.java | 0 .../sling-models-jacksonexporter.txt | 24 --- it/src/test/provisioning/sling.txt | 50 ------ it/test-models/bnd.bnd | 7 + it/test-models/pom.xml | 151 ++++++++++++++++++ .../delegate/request/DelegateBaseModel.java | 0 .../request/DelegateExtendedModel.java | 0 .../delegate/request/DelegateInterface.java | 0 .../it/delegate/request/package-info.java | 0 .../delegate/resource/DelegateBaseModel.java | 0 .../resource/DelegateExtendedModel.java | 0 .../delegate/resource/DelegateInterface.java | 0 .../it/delegate/resource/package-info.java | 0 .../it/delegate/viaoriginalresource/A.java | 0 .../it/delegate/viaoriginalresource/A1.java | 0 .../it/delegate/viaoriginalresource/B.java | 0 .../it/delegate/viaoriginalresource/B1.java | 0 .../viaoriginalresource/models/A1Impl.java | 0 .../viaoriginalresource/models/AImpl.java | 0 .../viaoriginalresource/models/B1Impl.java | 0 .../viaoriginalresource/models/BImpl.java | 0 .../models/package-info.java | 0 .../viaoriginalresource/package-info.java | 0 .../CustomLastImplementationPicker.java | 0 .../models/it/implpicker/package-info.java | 0 .../models/ConstructorInjectionTestModel.java | 0 .../it/models/FieldInjectionTestModel.java | 0 .../models/InterfaceInjectionTestModel.java | 0 .../it/models/ModelWithOptionalImport.java | 0 .../models/it/models/RequestSelfModel.java | 0 .../it/models/RequestSelfModelImpl.java | 0 .../sling/models/it/models/SelfModel.java | 0 .../it/models/ServiceInjectionTestModel.java | 0 .../SlingPropertyAnnotationTestModel.java | 0 .../sling/models/it/models/SourceObject.java | 0 .../sling/models/it/models/ViaModel.java | 0 .../implextend/ExtendsClassPropertyModel.java | 0 .../ImplementsInterfacePropertyModel.java | 0 .../ImplementsInterfacePropertyModel2.java | 0 ...validImplementsInterfacePropertyModel.java | 0 .../InvalidSampleServiceInterface.java | 0 .../implextend/SampleServiceInterface.java | 0 .../implextend/SimplePropertyModel.java | 0 .../it/models/implextend/package-info.java | 0 .../sling/models/it/models/package-info.java | 0 .../models/it/rtbound/BaseComponent.java | 0 .../models/it/rtbound/ExtendedComponent.java | 0 .../it/rtbound/FromRequestComponent.java | 0 .../sling/models/it/rtbound/package-info.java | 0 .../it/rtboundpicker/BaseComponent.java | 0 .../it/rtboundpicker/SubRTComponent.java | 0 .../it/rtboundpicker/TestComponent.java | 0 .../models/it/rtboundpicker/package-info.java | 0 .../AnotherTestBindingsValuesProvider.java | 0 .../models/it/services/SimpleService.java | 0 .../SimpleServiceWithCustomRanking.java | 0 .../services/TestBindingsValuesProvider.java | 0 .../it/services/TestResourceDecorator.java | 0 .../models/it/services/package-info.java | 0 .../models/it/servlets/PathBoundServlet.java | 0 .../apache/sling/models/it/noclasses/foo.txt | 0 pom.xml | 3 +- 82 files changed, 172 insertions(+), 144 deletions(-) rename it/{ => integration-tests}/bnd.bnd (100%) rename it/{ => integration-tests}/pom.xml (83%) rename it/{ => integration-tests}/src/main/features/launcher-repoinit.txt (100%) rename it/{ => integration-tests}/src/main/features/launcher.json (96%) rename it/{ => integration-tests}/src/test/java/org/apache/sling/junit/teleporter/customizers/SM_TeleporterCustomizer.java (100%) rename it/{ => integration-tests}/src/test/java/org/apache/sling/models/testing/DecoratedIT.java (100%) rename it/{ => integration-tests}/src/test/java/org/apache/sling/models/testing/ImplementsExtendsIT.java (100%) rename it/{ => integration-tests}/src/test/java/org/apache/sling/models/testing/InjectorSpecificAnnotationIT.java (100%) rename it/{ => integration-tests}/src/test/java/org/apache/sling/models/testing/ModelFactorySimpleIT.java (100%) rename it/{ => integration-tests}/src/test/java/org/apache/sling/models/testing/PathBoundServletIT.java (100%) rename it/{ => integration-tests}/src/test/java/org/apache/sling/models/testing/ServiceInjectionWithDifferentRankingIT.java (100%) rename it/{ => integration-tests}/src/test/java/org/apache/sling/models/testing/SimpleIT.java (100%) rename it/{ => integration-tests}/src/test/java/org/apache/sling/models/testing/ViaIT.java (100%) rename it/{ => integration-tests}/src/test/java/org/apache/sling/models/testing/delegate/DelegateRequestIT.java (100%) rename it/{ => integration-tests}/src/test/java/org/apache/sling/models/testing/delegate/DelegateResourceIT.java (100%) rename it/{ => integration-tests}/src/test/java/org/apache/sling/models/testing/delegate/viaoriginalresource/ViaOriginalResourceDelegationIT.java (100%) rename it/{ => integration-tests}/src/test/java/org/apache/sling/models/testing/helper/FakeRequest.java (100%) rename it/{ => integration-tests}/src/test/java/org/apache/sling/models/testing/helper/FakeResponse.java (100%) rename it/{ => integration-tests}/src/test/java/org/apache/sling/models/testing/rtbound/FakeRequest.java (100%) rename it/{ => integration-tests}/src/test/java/org/apache/sling/models/testing/rtbound/ResourceTypeBindingIT.java (100%) rename it/{ => integration-tests}/src/test/java/org/apache/sling/models/testing/rtboundpicker/ResourceTypePickerIT.java (100%) delete mode 100644 it/src/test/provisioning/sling-models-jacksonexporter.txt delete mode 100644 it/src/test/provisioning/sling.txt create mode 100644 it/test-models/bnd.bnd create mode 100644 it/test-models/pom.xml rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/delegate/request/DelegateBaseModel.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/delegate/request/DelegateExtendedModel.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/delegate/request/DelegateInterface.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/delegate/request/package-info.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateBaseModel.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateExtendedModel.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateInterface.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/delegate/resource/package-info.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/A.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/A1.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/B.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/B1.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/A1Impl.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/AImpl.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/B1Impl.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/BImpl.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/package-info.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/package-info.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/implpicker/CustomLastImplementationPicker.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/implpicker/package-info.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/ConstructorInjectionTestModel.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/FieldInjectionTestModel.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/InterfaceInjectionTestModel.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/ModelWithOptionalImport.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/RequestSelfModel.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/RequestSelfModelImpl.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/SelfModel.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/SlingPropertyAnnotationTestModel.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/SourceObject.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/ViaModel.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/implextend/ExtendsClassPropertyModel.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/implextend/ImplementsInterfacePropertyModel.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/implextend/ImplementsInterfacePropertyModel2.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/implextend/InvalidImplementsInterfacePropertyModel.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/implextend/InvalidSampleServiceInterface.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/implextend/SampleServiceInterface.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/implextend/SimplePropertyModel.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/implextend/package-info.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/models/package-info.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/rtbound/BaseComponent.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/rtbound/ExtendedComponent.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/rtbound/FromRequestComponent.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/rtbound/package-info.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/rtboundpicker/BaseComponent.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/rtboundpicker/SubRTComponent.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/rtboundpicker/TestComponent.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/rtboundpicker/package-info.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/services/AnotherTestBindingsValuesProvider.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/services/SimpleService.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/services/TestBindingsValuesProvider.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/services/TestResourceDecorator.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/services/package-info.java (100%) rename it/{ => test-models}/src/main/java/org/apache/sling/models/it/servlets/PathBoundServlet.java (100%) rename it/{ => test-models}/src/main/resources/org/apache/sling/models/it/noclasses/foo.txt (100%) diff --git a/it/bnd.bnd b/it/integration-tests/bnd.bnd similarity index 100% rename from it/bnd.bnd rename to it/integration-tests/bnd.bnd diff --git a/it/pom.xml b/it/integration-tests/pom.xml similarity index 83% rename from it/pom.xml rename to it/integration-tests/pom.xml index 00c99c9b..1a1f01a1 100644 --- a/it/pom.xml +++ b/it/integration-tests/pom.xml @@ -24,15 +24,12 @@ org.apache.sling org.apache.sling.models.impl.parent 2.0.1-SNAPSHOT - ../parent/pom.xml + ../../parent/pom.xml - org.apache.sling.models.impl.it + org.apache.sling.models.impl.it.integration-tests - Apache Sling Models Implementation - Integration Tests - Apache Sling Models Integration Tests - builds a bundle - with Sling server-side tests, and executes them via a - remote test proxy that runs in the integration-tests phase. + Apache Sling Models Implementation - IT - Integration Tests 14-SNAPSHOT @@ -42,39 +39,6 @@ - - org.osgi - org.osgi.framework - provided - - - org.osgi - org.osgi.service.component - provided - - - - - org.osgi - org.osgi.annotation.versioning - provided - - - org.osgi - org.osgi.service.component.annotations - provided - - - org.osgi - org.osgi.service.metatype.annotations - provided - - - org.apache.sling - org.apache.sling.servlets.annotations - provided - - org.apache.sling @@ -129,6 +93,12 @@ 2.0.1-SNAPSHOT provided + + org.apache.sling + org.apache.sling.models.impl.it.test-models + 2.0.1-SNAPSHOT + provided + @@ -141,11 +111,6 @@ jakarta.servlet-api provided - - javax.jcr - jcr - provided - org.apache.sling org.apache.sling.api @@ -158,12 +123,6 @@ 3.18.0 provided - - org.apache.geronimo.specs - geronimo-atinject_1.0_spec - 1.0 - provided - org.slf4j slf4j-api @@ -174,6 +133,7 @@ annotations provided + org.slf4j slf4j-simple @@ -184,13 +144,6 @@ junit test - - - commons-beanutils - commons-beanutils - 1.9.4 - provided - @@ -216,16 +169,6 @@ - - org.apache.rat - apache-rat-plugin - - - src/main/resources/org/apache/sling/models/it/noclasses/foo.txt - - - - org.codehaus.mojo build-helper-maven-plugin @@ -317,7 +260,7 @@ sling-starter-oak-tar org.apache.sling - org.apache.sling.models.impl.it + org.apache.sling.models.impl.it.integration-tests ${project.version} app slingosgifeature diff --git a/it/src/main/features/launcher-repoinit.txt b/it/integration-tests/src/main/features/launcher-repoinit.txt similarity index 100% rename from it/src/main/features/launcher-repoinit.txt rename to it/integration-tests/src/main/features/launcher-repoinit.txt diff --git a/it/src/main/features/launcher.json b/it/integration-tests/src/main/features/launcher.json similarity index 96% rename from it/src/main/features/launcher.json rename to it/integration-tests/src/main/features/launcher.json index cafa8a0c..2a20fcf6 100644 --- a/it/src/main/features/launcher.json +++ b/it/integration-tests/src/main/features/launcher.json @@ -9,7 +9,7 @@ "start-order": 20 }, { - "id": "org.apache.sling/org.apache.sling.models.impl.it/${project.version}", + "id": "org.apache.sling/org.apache.sling.models.impl.it.test-models/${project.version}", "start-order": 20 } ], diff --git a/it/src/test/java/org/apache/sling/junit/teleporter/customizers/SM_TeleporterCustomizer.java b/it/integration-tests/src/test/java/org/apache/sling/junit/teleporter/customizers/SM_TeleporterCustomizer.java similarity index 100% rename from it/src/test/java/org/apache/sling/junit/teleporter/customizers/SM_TeleporterCustomizer.java rename to it/integration-tests/src/test/java/org/apache/sling/junit/teleporter/customizers/SM_TeleporterCustomizer.java diff --git a/it/src/test/java/org/apache/sling/models/testing/DecoratedIT.java b/it/integration-tests/src/test/java/org/apache/sling/models/testing/DecoratedIT.java similarity index 100% rename from it/src/test/java/org/apache/sling/models/testing/DecoratedIT.java rename to it/integration-tests/src/test/java/org/apache/sling/models/testing/DecoratedIT.java diff --git a/it/src/test/java/org/apache/sling/models/testing/ImplementsExtendsIT.java b/it/integration-tests/src/test/java/org/apache/sling/models/testing/ImplementsExtendsIT.java similarity index 100% rename from it/src/test/java/org/apache/sling/models/testing/ImplementsExtendsIT.java rename to it/integration-tests/src/test/java/org/apache/sling/models/testing/ImplementsExtendsIT.java diff --git a/it/src/test/java/org/apache/sling/models/testing/InjectorSpecificAnnotationIT.java b/it/integration-tests/src/test/java/org/apache/sling/models/testing/InjectorSpecificAnnotationIT.java similarity index 100% rename from it/src/test/java/org/apache/sling/models/testing/InjectorSpecificAnnotationIT.java rename to it/integration-tests/src/test/java/org/apache/sling/models/testing/InjectorSpecificAnnotationIT.java diff --git a/it/src/test/java/org/apache/sling/models/testing/ModelFactorySimpleIT.java b/it/integration-tests/src/test/java/org/apache/sling/models/testing/ModelFactorySimpleIT.java similarity index 100% rename from it/src/test/java/org/apache/sling/models/testing/ModelFactorySimpleIT.java rename to it/integration-tests/src/test/java/org/apache/sling/models/testing/ModelFactorySimpleIT.java diff --git a/it/src/test/java/org/apache/sling/models/testing/PathBoundServletIT.java b/it/integration-tests/src/test/java/org/apache/sling/models/testing/PathBoundServletIT.java similarity index 100% rename from it/src/test/java/org/apache/sling/models/testing/PathBoundServletIT.java rename to it/integration-tests/src/test/java/org/apache/sling/models/testing/PathBoundServletIT.java diff --git a/it/src/test/java/org/apache/sling/models/testing/ServiceInjectionWithDifferentRankingIT.java b/it/integration-tests/src/test/java/org/apache/sling/models/testing/ServiceInjectionWithDifferentRankingIT.java similarity index 100% rename from it/src/test/java/org/apache/sling/models/testing/ServiceInjectionWithDifferentRankingIT.java rename to it/integration-tests/src/test/java/org/apache/sling/models/testing/ServiceInjectionWithDifferentRankingIT.java diff --git a/it/src/test/java/org/apache/sling/models/testing/SimpleIT.java b/it/integration-tests/src/test/java/org/apache/sling/models/testing/SimpleIT.java similarity index 100% rename from it/src/test/java/org/apache/sling/models/testing/SimpleIT.java rename to it/integration-tests/src/test/java/org/apache/sling/models/testing/SimpleIT.java diff --git a/it/src/test/java/org/apache/sling/models/testing/ViaIT.java b/it/integration-tests/src/test/java/org/apache/sling/models/testing/ViaIT.java similarity index 100% rename from it/src/test/java/org/apache/sling/models/testing/ViaIT.java rename to it/integration-tests/src/test/java/org/apache/sling/models/testing/ViaIT.java diff --git a/it/src/test/java/org/apache/sling/models/testing/delegate/DelegateRequestIT.java b/it/integration-tests/src/test/java/org/apache/sling/models/testing/delegate/DelegateRequestIT.java similarity index 100% rename from it/src/test/java/org/apache/sling/models/testing/delegate/DelegateRequestIT.java rename to it/integration-tests/src/test/java/org/apache/sling/models/testing/delegate/DelegateRequestIT.java diff --git a/it/src/test/java/org/apache/sling/models/testing/delegate/DelegateResourceIT.java b/it/integration-tests/src/test/java/org/apache/sling/models/testing/delegate/DelegateResourceIT.java similarity index 100% rename from it/src/test/java/org/apache/sling/models/testing/delegate/DelegateResourceIT.java rename to it/integration-tests/src/test/java/org/apache/sling/models/testing/delegate/DelegateResourceIT.java diff --git a/it/src/test/java/org/apache/sling/models/testing/delegate/viaoriginalresource/ViaOriginalResourceDelegationIT.java b/it/integration-tests/src/test/java/org/apache/sling/models/testing/delegate/viaoriginalresource/ViaOriginalResourceDelegationIT.java similarity index 100% rename from it/src/test/java/org/apache/sling/models/testing/delegate/viaoriginalresource/ViaOriginalResourceDelegationIT.java rename to it/integration-tests/src/test/java/org/apache/sling/models/testing/delegate/viaoriginalresource/ViaOriginalResourceDelegationIT.java diff --git a/it/src/test/java/org/apache/sling/models/testing/helper/FakeRequest.java b/it/integration-tests/src/test/java/org/apache/sling/models/testing/helper/FakeRequest.java similarity index 100% rename from it/src/test/java/org/apache/sling/models/testing/helper/FakeRequest.java rename to it/integration-tests/src/test/java/org/apache/sling/models/testing/helper/FakeRequest.java diff --git a/it/src/test/java/org/apache/sling/models/testing/helper/FakeResponse.java b/it/integration-tests/src/test/java/org/apache/sling/models/testing/helper/FakeResponse.java similarity index 100% rename from it/src/test/java/org/apache/sling/models/testing/helper/FakeResponse.java rename to it/integration-tests/src/test/java/org/apache/sling/models/testing/helper/FakeResponse.java diff --git a/it/src/test/java/org/apache/sling/models/testing/rtbound/FakeRequest.java b/it/integration-tests/src/test/java/org/apache/sling/models/testing/rtbound/FakeRequest.java similarity index 100% rename from it/src/test/java/org/apache/sling/models/testing/rtbound/FakeRequest.java rename to it/integration-tests/src/test/java/org/apache/sling/models/testing/rtbound/FakeRequest.java diff --git a/it/src/test/java/org/apache/sling/models/testing/rtbound/ResourceTypeBindingIT.java b/it/integration-tests/src/test/java/org/apache/sling/models/testing/rtbound/ResourceTypeBindingIT.java similarity index 100% rename from it/src/test/java/org/apache/sling/models/testing/rtbound/ResourceTypeBindingIT.java rename to it/integration-tests/src/test/java/org/apache/sling/models/testing/rtbound/ResourceTypeBindingIT.java diff --git a/it/src/test/java/org/apache/sling/models/testing/rtboundpicker/ResourceTypePickerIT.java b/it/integration-tests/src/test/java/org/apache/sling/models/testing/rtboundpicker/ResourceTypePickerIT.java similarity index 100% rename from it/src/test/java/org/apache/sling/models/testing/rtboundpicker/ResourceTypePickerIT.java rename to it/integration-tests/src/test/java/org/apache/sling/models/testing/rtboundpicker/ResourceTypePickerIT.java diff --git a/it/src/test/provisioning/sling-models-jacksonexporter.txt b/it/src/test/provisioning/sling-models-jacksonexporter.txt deleted file mode 100644 index a2a903d1..00000000 --- a/it/src/test/provisioning/sling-models-jacksonexporter.txt +++ /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. -# - -# must be the same feature name as the feature defined in slingstart to allow merging -[feature name=models-jacksonexporter] - -[artifacts] - org.apache.sling/org.apache.sling.models.jacksonexporter diff --git a/it/src/test/provisioning/sling.txt b/it/src/test/provisioning/sling.txt deleted file mode 100644 index d5d7e479..00000000 --- a/it/src/test/provisioning/sling.txt +++ /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. -# - -# must be the same feature name as the feature defined in slingstart to allow merging -[feature name=sling] - -[artifacts] - org.apache.sling/org.apache.sling.starter/11/slingstart - - # Update to newer bundles required by sling models impl - org.osgi/org.osgi.util.converter/1.0.9 - org.apache.sling/org.apache.sling.api/2.21.0 - org.apache.sling/org.apache.sling.resourceresolver/1.6.16 - org.apache.sling/org.apache.sling.servlets.resolver/2.5.8 - org.apache.sling/org.apache.sling.scripting.core/2.1.0 - - # Use versions as defined in POM - org.apache.sling/org.apache.sling.models.api - org.apache.sling/org.apache.sling.models.impl - - # Additional test bundles - org.apache.sling/org.apache.sling.junit.core - org.apache.sling/org.apache.sling.models.integration-tests - -[configurations] - # configure service user mapping for junit core (being used in the IT itself) - org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-junit - user.mapping=["org.apache.sling.junit.core\=models-it"] - -[:repoinit] - create service user models-it - set ACL for models-it - allow jcr:all on / - end diff --git a/it/test-models/bnd.bnd b/it/test-models/bnd.bnd new file mode 100644 index 00000000..1aef1d37 --- /dev/null +++ b/it/test-models/bnd.bnd @@ -0,0 +1,7 @@ +Sling-Test-Regexp: .*Test + +Import-Package:\ + org.apache.commons.beanutils;resolution:=optional,\ + * + +-plugin: org.apache.sling.bnd.models.ModelsScannerPlugin diff --git a/it/test-models/pom.xml b/it/test-models/pom.xml new file mode 100644 index 00000000..4d8b2f7e --- /dev/null +++ b/it/test-models/pom.xml @@ -0,0 +1,151 @@ + + + + 4.0.0 + + + org.apache.sling + org.apache.sling.models.impl.parent + 2.0.1-SNAPSHOT + ../../parent/pom.xml + + + org.apache.sling.models.impl.it.test-models + + Apache Sling Models Implementation - IT - Test Models + + + + org.osgi + org.osgi.service.component + provided + + + org.osgi + org.osgi.annotation.versioning + provided + + + org.osgi + org.osgi.service.component.annotations + provided + + + org.osgi + org.osgi.service.metatype.annotations + provided + + + org.apache.sling + org.apache.sling.servlets.annotations + provided + + + + + javax.servlet + javax.servlet-api + provided + + + jakarta.servlet + jakarta.servlet-api + provided + + + javax.jcr + jcr + provided + + + org.apache.sling + org.apache.sling.models.api + provided + + + org.apache.sling + org.apache.sling.api + 3.0.0 + provided + + + org.apache.commons + commons-lang3 + 3.18.0 + provided + + + org.apache.geronimo.specs + geronimo-atinject_1.0_spec + 1.0 + provided + + + org.jetbrains + annotations + provided + + + + + commons-beanutils + commons-beanutils + 1.9.4 + provided + + + + + + + + biz.aQute.bnd + bnd-maven-plugin + + + org.apache.sling + org.apache.sling.bnd.models + 1.0.0 + + + + + + biz.aQute.bnd + bnd-baseline-maven-plugin + + true + + + + + org.apache.rat + apache-rat-plugin + + + src/main/resources/org/apache/sling/models/it/noclasses/foo.txt + + + + + + + + diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/request/DelegateBaseModel.java b/it/test-models/src/main/java/org/apache/sling/models/it/delegate/request/DelegateBaseModel.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/delegate/request/DelegateBaseModel.java rename to it/test-models/src/main/java/org/apache/sling/models/it/delegate/request/DelegateBaseModel.java diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/request/DelegateExtendedModel.java b/it/test-models/src/main/java/org/apache/sling/models/it/delegate/request/DelegateExtendedModel.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/delegate/request/DelegateExtendedModel.java rename to it/test-models/src/main/java/org/apache/sling/models/it/delegate/request/DelegateExtendedModel.java diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/request/DelegateInterface.java b/it/test-models/src/main/java/org/apache/sling/models/it/delegate/request/DelegateInterface.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/delegate/request/DelegateInterface.java rename to it/test-models/src/main/java/org/apache/sling/models/it/delegate/request/DelegateInterface.java diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/request/package-info.java b/it/test-models/src/main/java/org/apache/sling/models/it/delegate/request/package-info.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/delegate/request/package-info.java rename to it/test-models/src/main/java/org/apache/sling/models/it/delegate/request/package-info.java diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateBaseModel.java b/it/test-models/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateBaseModel.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateBaseModel.java rename to it/test-models/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateBaseModel.java diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateExtendedModel.java b/it/test-models/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateExtendedModel.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateExtendedModel.java rename to it/test-models/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateExtendedModel.java diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateInterface.java b/it/test-models/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateInterface.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateInterface.java rename to it/test-models/src/main/java/org/apache/sling/models/it/delegate/resource/DelegateInterface.java diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/resource/package-info.java b/it/test-models/src/main/java/org/apache/sling/models/it/delegate/resource/package-info.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/delegate/resource/package-info.java rename to it/test-models/src/main/java/org/apache/sling/models/it/delegate/resource/package-info.java diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/A.java b/it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/A.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/A.java rename to it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/A.java diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/A1.java b/it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/A1.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/A1.java rename to it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/A1.java diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/B.java b/it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/B.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/B.java rename to it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/B.java diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/B1.java b/it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/B1.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/B1.java rename to it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/B1.java diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/A1Impl.java b/it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/A1Impl.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/A1Impl.java rename to it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/A1Impl.java diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/AImpl.java b/it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/AImpl.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/AImpl.java rename to it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/AImpl.java diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/B1Impl.java b/it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/B1Impl.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/B1Impl.java rename to it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/B1Impl.java diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/BImpl.java b/it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/BImpl.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/BImpl.java rename to it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/BImpl.java diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/package-info.java b/it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/package-info.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/package-info.java rename to it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/models/package-info.java diff --git a/it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/package-info.java b/it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/package-info.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/package-info.java rename to it/test-models/src/main/java/org/apache/sling/models/it/delegate/viaoriginalresource/package-info.java diff --git a/it/src/main/java/org/apache/sling/models/it/implpicker/CustomLastImplementationPicker.java b/it/test-models/src/main/java/org/apache/sling/models/it/implpicker/CustomLastImplementationPicker.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/implpicker/CustomLastImplementationPicker.java rename to it/test-models/src/main/java/org/apache/sling/models/it/implpicker/CustomLastImplementationPicker.java diff --git a/it/src/main/java/org/apache/sling/models/it/implpicker/package-info.java b/it/test-models/src/main/java/org/apache/sling/models/it/implpicker/package-info.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/implpicker/package-info.java rename to it/test-models/src/main/java/org/apache/sling/models/it/implpicker/package-info.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/ConstructorInjectionTestModel.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/ConstructorInjectionTestModel.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/ConstructorInjectionTestModel.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/ConstructorInjectionTestModel.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/FieldInjectionTestModel.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/FieldInjectionTestModel.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/FieldInjectionTestModel.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/FieldInjectionTestModel.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/InterfaceInjectionTestModel.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/InterfaceInjectionTestModel.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/InterfaceInjectionTestModel.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/InterfaceInjectionTestModel.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/ModelWithOptionalImport.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/ModelWithOptionalImport.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/ModelWithOptionalImport.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/ModelWithOptionalImport.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/RequestSelfModel.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/RequestSelfModel.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/RequestSelfModel.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/RequestSelfModel.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/RequestSelfModelImpl.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/RequestSelfModelImpl.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/RequestSelfModelImpl.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/RequestSelfModelImpl.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/SelfModel.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/SelfModel.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/SelfModel.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/SelfModel.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/SlingPropertyAnnotationTestModel.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/SlingPropertyAnnotationTestModel.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/SlingPropertyAnnotationTestModel.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/SlingPropertyAnnotationTestModel.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/SourceObject.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/SourceObject.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/SourceObject.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/SourceObject.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/ViaModel.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/ViaModel.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/ViaModel.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/ViaModel.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/implextend/ExtendsClassPropertyModel.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/implextend/ExtendsClassPropertyModel.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/implextend/ExtendsClassPropertyModel.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/implextend/ExtendsClassPropertyModel.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/implextend/ImplementsInterfacePropertyModel.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/implextend/ImplementsInterfacePropertyModel.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/implextend/ImplementsInterfacePropertyModel.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/implextend/ImplementsInterfacePropertyModel.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/implextend/ImplementsInterfacePropertyModel2.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/implextend/ImplementsInterfacePropertyModel2.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/implextend/ImplementsInterfacePropertyModel2.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/implextend/ImplementsInterfacePropertyModel2.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/implextend/InvalidImplementsInterfacePropertyModel.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/implextend/InvalidImplementsInterfacePropertyModel.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/implextend/InvalidImplementsInterfacePropertyModel.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/implextend/InvalidImplementsInterfacePropertyModel.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/implextend/InvalidSampleServiceInterface.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/implextend/InvalidSampleServiceInterface.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/implextend/InvalidSampleServiceInterface.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/implextend/InvalidSampleServiceInterface.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/implextend/SampleServiceInterface.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/implextend/SampleServiceInterface.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/implextend/SampleServiceInterface.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/implextend/SampleServiceInterface.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/implextend/SimplePropertyModel.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/implextend/SimplePropertyModel.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/implextend/SimplePropertyModel.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/implextend/SimplePropertyModel.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/implextend/package-info.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/implextend/package-info.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/implextend/package-info.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/implextend/package-info.java diff --git a/it/src/main/java/org/apache/sling/models/it/models/package-info.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/package-info.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/models/package-info.java rename to it/test-models/src/main/java/org/apache/sling/models/it/models/package-info.java diff --git a/it/src/main/java/org/apache/sling/models/it/rtbound/BaseComponent.java b/it/test-models/src/main/java/org/apache/sling/models/it/rtbound/BaseComponent.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/rtbound/BaseComponent.java rename to it/test-models/src/main/java/org/apache/sling/models/it/rtbound/BaseComponent.java diff --git a/it/src/main/java/org/apache/sling/models/it/rtbound/ExtendedComponent.java b/it/test-models/src/main/java/org/apache/sling/models/it/rtbound/ExtendedComponent.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/rtbound/ExtendedComponent.java rename to it/test-models/src/main/java/org/apache/sling/models/it/rtbound/ExtendedComponent.java diff --git a/it/src/main/java/org/apache/sling/models/it/rtbound/FromRequestComponent.java b/it/test-models/src/main/java/org/apache/sling/models/it/rtbound/FromRequestComponent.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/rtbound/FromRequestComponent.java rename to it/test-models/src/main/java/org/apache/sling/models/it/rtbound/FromRequestComponent.java diff --git a/it/src/main/java/org/apache/sling/models/it/rtbound/package-info.java b/it/test-models/src/main/java/org/apache/sling/models/it/rtbound/package-info.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/rtbound/package-info.java rename to it/test-models/src/main/java/org/apache/sling/models/it/rtbound/package-info.java diff --git a/it/src/main/java/org/apache/sling/models/it/rtboundpicker/BaseComponent.java b/it/test-models/src/main/java/org/apache/sling/models/it/rtboundpicker/BaseComponent.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/rtboundpicker/BaseComponent.java rename to it/test-models/src/main/java/org/apache/sling/models/it/rtboundpicker/BaseComponent.java diff --git a/it/src/main/java/org/apache/sling/models/it/rtboundpicker/SubRTComponent.java b/it/test-models/src/main/java/org/apache/sling/models/it/rtboundpicker/SubRTComponent.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/rtboundpicker/SubRTComponent.java rename to it/test-models/src/main/java/org/apache/sling/models/it/rtboundpicker/SubRTComponent.java diff --git a/it/src/main/java/org/apache/sling/models/it/rtboundpicker/TestComponent.java b/it/test-models/src/main/java/org/apache/sling/models/it/rtboundpicker/TestComponent.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/rtboundpicker/TestComponent.java rename to it/test-models/src/main/java/org/apache/sling/models/it/rtboundpicker/TestComponent.java diff --git a/it/src/main/java/org/apache/sling/models/it/rtboundpicker/package-info.java b/it/test-models/src/main/java/org/apache/sling/models/it/rtboundpicker/package-info.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/rtboundpicker/package-info.java rename to it/test-models/src/main/java/org/apache/sling/models/it/rtboundpicker/package-info.java diff --git a/it/src/main/java/org/apache/sling/models/it/services/AnotherTestBindingsValuesProvider.java b/it/test-models/src/main/java/org/apache/sling/models/it/services/AnotherTestBindingsValuesProvider.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/services/AnotherTestBindingsValuesProvider.java rename to it/test-models/src/main/java/org/apache/sling/models/it/services/AnotherTestBindingsValuesProvider.java diff --git a/it/src/main/java/org/apache/sling/models/it/services/SimpleService.java b/it/test-models/src/main/java/org/apache/sling/models/it/services/SimpleService.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/services/SimpleService.java rename to it/test-models/src/main/java/org/apache/sling/models/it/services/SimpleService.java diff --git a/it/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java b/it/test-models/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java rename to it/test-models/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java diff --git a/it/src/main/java/org/apache/sling/models/it/services/TestBindingsValuesProvider.java b/it/test-models/src/main/java/org/apache/sling/models/it/services/TestBindingsValuesProvider.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/services/TestBindingsValuesProvider.java rename to it/test-models/src/main/java/org/apache/sling/models/it/services/TestBindingsValuesProvider.java diff --git a/it/src/main/java/org/apache/sling/models/it/services/TestResourceDecorator.java b/it/test-models/src/main/java/org/apache/sling/models/it/services/TestResourceDecorator.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/services/TestResourceDecorator.java rename to it/test-models/src/main/java/org/apache/sling/models/it/services/TestResourceDecorator.java diff --git a/it/src/main/java/org/apache/sling/models/it/services/package-info.java b/it/test-models/src/main/java/org/apache/sling/models/it/services/package-info.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/services/package-info.java rename to it/test-models/src/main/java/org/apache/sling/models/it/services/package-info.java diff --git a/it/src/main/java/org/apache/sling/models/it/servlets/PathBoundServlet.java b/it/test-models/src/main/java/org/apache/sling/models/it/servlets/PathBoundServlet.java similarity index 100% rename from it/src/main/java/org/apache/sling/models/it/servlets/PathBoundServlet.java rename to it/test-models/src/main/java/org/apache/sling/models/it/servlets/PathBoundServlet.java diff --git a/it/src/main/resources/org/apache/sling/models/it/noclasses/foo.txt b/it/test-models/src/main/resources/org/apache/sling/models/it/noclasses/foo.txt similarity index 100% rename from it/src/main/resources/org/apache/sling/models/it/noclasses/foo.txt rename to it/test-models/src/main/resources/org/apache/sling/models/it/noclasses/foo.txt diff --git a/pom.xml b/pom.xml index df4c0dfc..461dcc11 100644 --- a/pom.xml +++ b/pom.xml @@ -35,6 +35,7 @@ parent impl - it + it/test-models + it/integration-tests From 3bf04dbb0b5fc69e6ad78bbf7e4c49db5f82420b Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Fri, 9 Jan 2026 19:54:45 +0100 Subject: [PATCH 09/16] add integration test case with jakarta servlet --- .../models/testing/PathBoundServletIT.java | 10 ++++ .../it/models/JakartaRequestSelfModel.java | 26 +++++++++++ .../models/JakartaRequestSelfModelImpl.java | 34 ++++++++++++++ .../it/servlets/PathBoundJakartaServlet.java | 46 +++++++++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 it/test-models/src/main/java/org/apache/sling/models/it/models/JakartaRequestSelfModel.java create mode 100644 it/test-models/src/main/java/org/apache/sling/models/it/models/JakartaRequestSelfModelImpl.java create mode 100644 it/test-models/src/main/java/org/apache/sling/models/it/servlets/PathBoundJakartaServlet.java diff --git a/it/integration-tests/src/test/java/org/apache/sling/models/testing/PathBoundServletIT.java b/it/integration-tests/src/test/java/org/apache/sling/models/testing/PathBoundServletIT.java index 1bd4ad16..bec53f8b 100644 --- a/it/integration-tests/src/test/java/org/apache/sling/models/testing/PathBoundServletIT.java +++ b/it/integration-tests/src/test/java/org/apache/sling/models/testing/PathBoundServletIT.java @@ -53,4 +53,14 @@ public void testDoubledServlets() throws Exception { Assert.assertEquals(200, response.getStatus()); } } + + @Test + public void testDoubledServletsJakarta() throws Exception { + try (ResourceResolver resolver = rrFactory.getServiceResourceResolver(null); ) { + FakeResponse response = new FakeResponse(); + slingRequestProcessor.processRequest(new FakeRequest("/apps/rtpickerrequest-jakarta"), response, resolver); + + Assert.assertEquals(200, response.getStatus()); + } + } } diff --git a/it/test-models/src/main/java/org/apache/sling/models/it/models/JakartaRequestSelfModel.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/JakartaRequestSelfModel.java new file mode 100644 index 00000000..24282aff --- /dev/null +++ b/it/test-models/src/main/java/org/apache/sling/models/it/models/JakartaRequestSelfModel.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models; + +import org.apache.sling.api.SlingJakartaHttpServletRequest; + +public interface JakartaRequestSelfModel { + + SlingJakartaHttpServletRequest getRequest(); +} diff --git a/it/test-models/src/main/java/org/apache/sling/models/it/models/JakartaRequestSelfModelImpl.java b/it/test-models/src/main/java/org/apache/sling/models/it/models/JakartaRequestSelfModelImpl.java new file mode 100644 index 00000000..ab7261a1 --- /dev/null +++ b/it/test-models/src/main/java/org/apache/sling/models/it/models/JakartaRequestSelfModelImpl.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.models; + +import org.apache.sling.api.SlingJakartaHttpServletRequest; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.injectorspecific.Self; + +@Model(adaptables = SlingJakartaHttpServletRequest.class, adapters = RequestSelfModel.class) +public class JakartaRequestSelfModelImpl implements JakartaRequestSelfModel { + + @Self + private SlingJakartaHttpServletRequest request; + + public SlingJakartaHttpServletRequest getRequest() { + return request; + } +} diff --git a/it/test-models/src/main/java/org/apache/sling/models/it/servlets/PathBoundJakartaServlet.java b/it/test-models/src/main/java/org/apache/sling/models/it/servlets/PathBoundJakartaServlet.java new file mode 100644 index 00000000..4900f294 --- /dev/null +++ b/it/test-models/src/main/java/org/apache/sling/models/it/servlets/PathBoundJakartaServlet.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.models.it.servlets; + +import java.io.IOException; + +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletException; +import org.apache.sling.api.SlingJakartaHttpServletRequest; +import org.apache.sling.api.SlingJakartaHttpServletResponse; +import org.apache.sling.api.servlets.SlingJakartaSafeMethodsServlet; +import org.apache.sling.models.it.models.JakartaRequestSelfModel; +import org.apache.sling.servlets.annotations.SlingServletPaths; +import org.jetbrains.annotations.NotNull; +import org.osgi.service.component.annotations.Component; + +@Component(service = Servlet.class) +@SlingServletPaths("/apps/rtpickerrequest-jakarta") +public class PathBoundJakartaServlet extends SlingJakartaSafeMethodsServlet { + private static final long serialVersionUID = 1L; + + @Override + @SuppressWarnings("unused") + protected void doGet( + @NotNull SlingJakartaHttpServletRequest request, @NotNull SlingJakartaHttpServletResponse response) + throws ServletException, IOException { + JakartaRequestSelfModel model = request.adaptTo(JakartaRequestSelfModel.class); + response.setStatus(200); + } +} From cd80221aee99b11c3313422b92e9f5cd97e2d7d2 Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Fri, 9 Jan 2026 20:01:47 +0100 Subject: [PATCH 10/16] enable jacoco code coverage --- it/integration-tests/pom.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/it/integration-tests/pom.xml b/it/integration-tests/pom.xml index 1a1f01a1..ef41cb34 100644 --- a/it/integration-tests/pom.xml +++ b/it/integration-tests/pom.xml @@ -33,6 +33,8 @@ 14-SNAPSHOT + 0.8.14 + 200 60 info @@ -144,6 +146,16 @@ junit test + + + + org.jacoco + org.jacoco.agent + ${jacoco.agent.version} + runtime + test + + @@ -268,6 +280,9 @@ --add-opens java.base/java.lang=ALL-UNNAMED + + -javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.agent.version}/org.jacoco.agent-${jacoco.agent.version}-runtime.jar=destfile=${project.build.directory}/jacoco-launchpad.exec ${http.port} From d2e3edf913cde2caf6261215752c6bd87416ea67 Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Fri, 9 Jan 2026 20:22:46 +0100 Subject: [PATCH 11/16] enable jacoco code coverage --- it/integration-tests/pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/it/integration-tests/pom.xml b/it/integration-tests/pom.xml index ef41cb34..2da5a874 100644 --- a/it/integration-tests/pom.xml +++ b/it/integration-tests/pom.xml @@ -33,7 +33,7 @@ 14-SNAPSHOT - 0.8.14 + 0.8.14 200 60 @@ -151,7 +151,7 @@ org.jacoco org.jacoco.agent - ${jacoco.agent.version} + ${jacoco-maven-plugin.version} runtime test @@ -282,7 +282,7 @@ --add-opens java.base/java.lang=ALL-UNNAMED - -javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.agent.version}/org.jacoco.agent-${jacoco.agent.version}-runtime.jar=destfile=${project.build.directory}/jacoco-launchpad.exec + -javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco-maven-plugin.version}/org.jacoco.agent-${jacoco-maven-plugin.version}-runtime.jar=destfile=${project.build.directory}/jacoco-it.exec ${http.port} From 1294273e4754b0929b52e87bc7f862c8909d733b Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Fri, 9 Jan 2026 20:32:26 +0100 Subject: [PATCH 12/16] sync jacoco version with sling-parent --- it/integration-tests/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/integration-tests/pom.xml b/it/integration-tests/pom.xml index 2da5a874..2c6fa0cd 100644 --- a/it/integration-tests/pom.xml +++ b/it/integration-tests/pom.xml @@ -33,7 +33,7 @@ 14-SNAPSHOT - 0.8.14 + 0.8.13 200 60 From 7efbeeccde263bfb4bef3364b5601379e56b48a8 Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Mon, 12 Jan 2026 17:56:24 +0100 Subject: [PATCH 13/16] prepare jacoco agent via plugin --- it/integration-tests/pom.xml | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/it/integration-tests/pom.xml b/it/integration-tests/pom.xml index 2c6fa0cd..76767b9f 100644 --- a/it/integration-tests/pom.xml +++ b/it/integration-tests/pom.xml @@ -33,7 +33,6 @@ 14-SNAPSHOT - 0.8.13 200 60 @@ -147,15 +146,6 @@ test - - - org.jacoco - org.jacoco.agent - ${jacoco-maven-plugin.version} - runtime - test - - @@ -262,6 +252,25 @@ + + org.jacoco + jacoco-maven-plugin + + + prepare-agent-integration-launcher + + prepare-agent-integration + + + true + ${project.build.directory}/jacoco-launcher.exec + jacoco.launcher.command + true + + + + + org.apache.sling feature-launcher-maven-plugin @@ -280,9 +289,7 @@ --add-opens java.base/java.lang=ALL-UNNAMED - - -javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco-maven-plugin.version}/org.jacoco.agent-${jacoco-maven-plugin.version}-runtime.jar=destfile=${project.build.directory}/jacoco-it.exec + ${jacoco.launcher.command} ${http.port} From 719b18356dd0617e2d1ba2e471f8cd4c72ec8769 Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Mon, 12 Jan 2026 18:19:21 +0100 Subject: [PATCH 14/16] record integration test coverage --- it/integration-tests/pom.xml | 43 +++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/it/integration-tests/pom.xml b/it/integration-tests/pom.xml index 76767b9f..e8cc7712 100644 --- a/it/integration-tests/pom.xml +++ b/it/integration-tests/pom.xml @@ -184,6 +184,7 @@ http.port + jacoco.port @@ -252,6 +253,10 @@ + org.jacoco jacoco-maven-plugin @@ -262,10 +267,42 @@ prepare-agent-integration - true - ${project.build.directory}/jacoco-launcher.exec jacoco.launcher.command - true + tcpserver +
localhost
+ ${jacoco.port} +
+ + + dump-coverage-launcher + + dump + + post-integration-test + +
localhost
+ ${jacoco.port} + ${project.build.directory}/jacoco-launcher.exec + true +
+
+ + merge-it-and-launcher + + merge + + post-integration-test + + ${project.build.directory}/jacoco-merged.exec + + + ${project.build.directory} + + jacoco-it.exec + jacoco-launcher.exec + + + From 289104491e7378e28558cf67199bff20e04a77c1 Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Mon, 12 Jan 2026 19:14:35 +0100 Subject: [PATCH 15/16] overwrite jacoco report with report-aggregated --- it/integration-tests/pom.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/it/integration-tests/pom.xml b/it/integration-tests/pom.xml index e8cc7712..884d3270 100644 --- a/it/integration-tests/pom.xml +++ b/it/integration-tests/pom.xml @@ -305,6 +305,17 @@ + + report-aggregate-merged + + report-aggregate + + verify + + ${project.build.directory}/jacoco-merged.exec + ${project.reporting.outputDirectory}/jacoco-merged + +
From 477b6d0206cb7e9dfd4811586d5085910505bb2f Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Mon, 12 Jan 2026 20:00:02 +0100 Subject: [PATCH 16/16] update jacoco report comments --- it/integration-tests/pom.xml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/it/integration-tests/pom.xml b/it/integration-tests/pom.xml index 884d3270..ca989756 100644 --- a/it/integration-tests/pom.xml +++ b/it/integration-tests/pom.xml @@ -253,14 +253,14 @@ - org.jacoco jacoco-maven-plugin + prepare-agent-integration-launcher @@ -286,6 +286,10 @@ true + merge-it-and-launcher @@ -305,6 +309,10 @@ + report-aggregate-merged