You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2014/10/22 22:20:56 UTC

svn commit: r1633709 - in /sling/trunk/bundles/extensions/models: api/src/main/java/org/apache/sling/models/factory/ impl/src/main/java/org/apache/sling/models/impl/ impl/src/test/java/org/apache/sling/models/impl/ impl/src/test/java/org/apache/sling/m...

Author: sseifert
Date: Wed Oct 22 20:20:55 2014
New Revision: 1633709

URL: http://svn.apache.org/r1633709
Log:
SLING-4056 ModelFactory.canCreateFromAdaptable reports false errors when using "adapters" on models (patch suppplied by Konrad Windszus)

Added:
    sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/AdapterFactoryTest.java   (with props)
    sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/ConstructorWithExceptionModel.java   (with props)
    sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/InvalidModelWithMissingAnnotation.java   (with props)
Modified:
    sling/trunk/bundles/extensions/models/api/src/main/java/org/apache/sling/models/factory/ModelFactory.java
    sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
    sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/Result.java
    sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ImplementsExtendsTest.java

Modified: sling/trunk/bundles/extensions/models/api/src/main/java/org/apache/sling/models/factory/ModelFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/api/src/main/java/org/apache/sling/models/factory/ModelFactory.java?rev=1633709&r1=1633708&r2=1633709&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/api/src/main/java/org/apache/sling/models/factory/ModelFactory.java (original)
+++ sling/trunk/bundles/extensions/models/api/src/main/java/org/apache/sling/models/factory/ModelFactory.java Wed Oct 22 20:20:55 2014
@@ -25,7 +25,7 @@ package org.apache.sling.models.factory;
  */
 public interface ModelFactory {
     /**
-     * Instantiates the given Sling Model class from the given adaptable
+     * Instantiates the given Sling Model class from the given adaptable.
      * @param adaptable the adaptable to use to instantiate the Sling Model Class
      * @param type the class to instantiate
      * @return a new instance for the required model (never null)
@@ -38,19 +38,20 @@ public interface ModelFactory {
 
     /**
      * 
-     * @param modelClass the class to check
      * @param adaptable the adaptable to check
-     * @return false in case the given class can not be adapted from the given adaptable
-     * @throws InvalidModelException in case the given class does not have a model annotation
+     * @param type the class to check
+     * @return false in case the given class can not be created from the given adaptable
+     * @throws InvalidModelException in case no class with the Model annotation adapts to the requested type
      */
-    public boolean canCreateFromAdaptable(Object adaptable, Class<?> modelClass) throws InvalidModelException;
+    public boolean canCreateFromAdaptable(Object adaptable, Class<?> type) throws InvalidModelException;
 
     /**
      * 
-     * @param modelClass the class to check
-     * @return false in case the given class has no model annotation
+     * @param adaptable the adaptable to check
+     * @param type the class to check
+     * @return false in case no class with the Model annotation adapts to the requested type
      * 
      * @see org.apache.sling.models.annotations.Model
      */
-    public boolean isModelClass(Class<?> modelClass);
+    public boolean isModelClass(Object adaptable, Class<?> type);
 }

Modified: sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java?rev=1633709&r1=1633708&r2=1633709&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java (original)
+++ sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java Wed Oct 22 20:20:55 2014
@@ -180,10 +180,11 @@ public class ModelAdapterFactory impleme
 
     @Override
     public boolean canCreateFromAdaptable(Object adaptable, Class<?> modelClass) throws InvalidModelException {
-        return innerCanCreateFromAdaptable(modelClass, adaptable);
+        return innerCanCreateFromAdaptable(adaptable, modelClass);
     }
 
-    private static boolean innerCanCreateFromAdaptable(Class<?> modelClass, Object adaptable) throws InvalidModelException {
+    private boolean innerCanCreateFromAdaptable(Object adaptable, Class<?> modelClass) throws InvalidModelException {
+        modelClass = getImplementationTypeForAdapterType(modelClass, adaptable);
         Model modelAnnotation = modelClass.getAnnotation(Model.class);
         if (modelAnnotation == null) {
             throw new InvalidModelException(String.format("Model class '%s' does not have a model annotation", modelClass));
@@ -199,12 +200,28 @@ public class ModelAdapterFactory impleme
     }
 
     @Override
-    public boolean isModelClass(Class<?> modelClass) {
-        return innerIsModelClass(modelClass);
+    public boolean isModelClass(Object adaptable, Class<?> type) {
+        type = getImplementationTypeForAdapterType(type, adaptable);
+        return type.getAnnotation(Model.class) != null;
     }
 
-    private static boolean innerIsModelClass(Class<?> clazz) {
-        return clazz.getAnnotation(Model.class) != null;
+    /**
+     * 
+     * @param type
+     * @param adaptable
+     * @return the implementation type to use for the desired model type
+     * @see <a
+     *      href="http://sling.apache.org/documentation/bundles/models.html#specifying-an-alternate-adapter-class-since-sling-models-110">Specifying
+     *      an Alternate Adapter Class</a>
+     */
+    private Class<?> getImplementationTypeForAdapterType(Class<?> type, Object adaptable) {
+        // check if a different implementation class was registered for this adapter type
+        Class<?> implementationType = this.adapterImplementations.lookup(type, adaptable);
+        if (implementationType != null) {
+            log.debug("Using implementation type {} for requested adapter type {}", implementationType, type);
+            return implementationType;
+        }
+        return type;
     }
 
     @SuppressWarnings("unchecked")
@@ -220,10 +237,7 @@ public class ModelAdapterFactory impleme
         threadInvocationCounter.increase();
         try {
             // check if a different implementation class was registered for this adapter type
-            Class<?> implementationType = this.adapterImplementations.lookup(type, adaptable);
-            if (implementationType != null) {
-                type = (Class<ModelType>) implementationType;
-            }
+            type = (Class<ModelType>) getImplementationTypeForAdapterType(type, adaptable);
 
             Model modelAnnotation = type.getAnnotation(Model.class);
             if (modelAnnotation == null) {
@@ -897,7 +911,7 @@ public class ModelAdapterFactory impleme
     private Object adaptIfNecessary(Object value, Class<?> type, Type genericType, Result<?> parentResult) {
         if (!isAcceptableType(type, genericType, value)) {
             Class<?> declaredType = type;
-            if (isModelClass(type) && canCreateFromAdaptable(value, type)) {
+            if (isModelClass(value, type) && canCreateFromAdaptable(value, type)) {
                 Result<?> result = internalCreateModel(value, type);
                 if (result.getModel() == null) {
                     parentResult.appendFailures(result);

Modified: sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/Result.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/Result.java?rev=1633709&r1=1633708&r2=1633709&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/Result.java (original)
+++ sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/Result.java Wed Oct 22 20:20:55 2014
@@ -38,7 +38,7 @@ public class Result<ModelType> {
         OTHER("Unclassified problem"),
         MISSING_METHODS("Required methods %s on model %s were not able to be injected."),
         MISSING_FIELDS("Required fields %s on model %s were not able to be injected."),
-        MISSING_CONSTRUCTOR_PARAMS("Required constructor parameteres %s on model %s were not able to be injected.");
+        MISSING_CONSTRUCTOR_PARAMS("Required constructor parameters %s on model %s were not able to be injected.");
 
         private String message;
 

Added: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/AdapterFactoryTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/AdapterFactoryTest.java?rev=1633709&view=auto
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/AdapterFactoryTest.java (added)
+++ sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/AdapterFactoryTest.java Wed Oct 22 20:20:55 2014
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS 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.impl;
+
+import static org.mockito.Mockito.when;
+
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ValueMap;
+import org.apache.sling.api.wrappers.ValueMapDecorator;
+import org.apache.sling.models.annotations.Model;
+import org.apache.sling.models.annotations.injectorspecific.Self;
+import org.apache.sling.models.factory.InvalidAdaptableException;
+import org.apache.sling.models.factory.InvalidModelException;
+import org.apache.sling.models.factory.MissingElementsException;
+import org.apache.sling.models.impl.injectors.SelfInjector;
+import org.apache.sling.models.impl.injectors.ValueMapInjector;
+import org.apache.sling.models.testmodels.classes.ConstructorWithExceptionModel;
+import org.apache.sling.models.testmodels.classes.DefaultStringModel;
+import org.apache.sling.models.testmodels.classes.InvalidModelWithMissingAnnotation;
+import org.apache.sling.models.testmodels.classes.ResourceModelWithRequiredField;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.ComponentContext;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AdapterFactoryTest {
+    @Mock
+    private ComponentContext componentCtx;
+
+    @Mock
+    private BundleContext bundleContext;
+
+    @Mock
+    private Resource resource;
+
+    @Mock
+    private SlingHttpServletRequest request;
+
+    private ModelAdapterFactory factory;
+
+    @Before
+    public void setup() {
+        when(componentCtx.getBundleContext()).thenReturn(bundleContext);
+        when(componentCtx.getProperties()).thenReturn(new Hashtable<String, Object>());
+
+        factory = new ModelAdapterFactory();
+        factory.activate(componentCtx);
+        factory.bindInjector(new ValueMapInjector(), new ServicePropertiesMap(0, 0));
+        factory.bindInjector(new SelfInjector(), new ServicePropertiesMap(1, 1));
+    }
+
+    @Test
+    public void testIsModelClass() {
+        Assert.assertTrue(factory.isModelClass(resource, DefaultStringModel.class));
+        Assert.assertFalse(factory.isModelClass(resource, InvalidModelWithMissingAnnotation.class));
+    }
+
+    @Test
+    public void testCanCreateFromAdaptable() {
+        Assert.assertTrue(factory.canCreateFromAdaptable(resource, DefaultStringModel.class));
+        Assert.assertFalse(factory.canCreateFromAdaptable(request, DefaultStringModel.class));
+    }
+
+    @Test(expected = InvalidModelException.class)
+    public void testCanCreateFromAdaptableWithInvalidModel() {
+        factory.canCreateFromAdaptable(resource, InvalidModelWithMissingAnnotation.class);
+    }
+
+    @Test(expected = InvalidModelException.class)
+    public void testCreateFromNonModelClass() {
+        factory.createModel(resource, InvalidModelWithMissingAnnotation.class);
+    }
+
+    @Test(expected = InvalidAdaptableException.class)
+    public void testCreateFromInvalidAdaptable() {
+        factory.createModel(request, DefaultStringModel.class);
+    }
+
+    @Test(expected = RuntimeException.class)
+    public void testCreateWithConstructorException() {
+        // Internally all exceptions are wrapped within RuntimeExceptions
+        factory.createModel(resource, ConstructorWithExceptionModel.class);
+    }
+
+    @Model(adaptables = SlingHttpServletRequest.class)
+    public static class NestedModelWithInvalidAdaptable {
+        @Self
+        DefaultStringModel nestedModel;
+    }
+
+    @Test(expected = MissingElementsException.class)
+    public void testCreatedNestedModelWithInvalidAdaptable() {
+        // nested model can only be adapted from another adaptable
+        factory.createModel(request, NestedModelWithInvalidAdaptable.class);
+    }
+
+    @Model(adaptables = SlingHttpServletRequest.class)
+    public static class NestedModelWithInvalidAdaptable2 {
+        @Self
+        InvalidModelWithMissingAnnotation nestedModel;
+    }
+
+    @Test(expected = MissingElementsException.class)
+    public void testCreatedNestedModelWithInvalidAdaptable2() {
+        // nested model is in fact no valid model
+        factory.createModel(request, NestedModelWithInvalidAdaptable2.class);
+    }
+
+    @Model(adaptables = Resource.class)
+    public static class NestedModel {
+        @Self
+        ResourceModelWithRequiredField nestedModel;
+
+        public ResourceModelWithRequiredField getNestedModel() {
+            return nestedModel;
+        }
+    }
+
+    @Test
+    public void testCreatedNestedModel() {
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("required", "required");
+        ValueMap vm = new ValueMapDecorator(map);
+        when(resource.adaptTo(ValueMap.class)).thenReturn(vm);
+
+        NestedModel model = factory.createModel(resource, NestedModel.class);
+        Assert.assertNotNull(model);
+        Assert.assertEquals("required", model.getNestedModel().getRequired());
+    }
+
+    @Test(expected=MissingElementsException.class)
+    public void testCreatedNestedModelWithMissingElements() {
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("invalid", "required");
+        ValueMap vm = new ValueMapDecorator(map);
+        when(resource.adaptTo(ValueMap.class)).thenReturn(vm);
+
+        factory.createModel(resource, NestedModel.class);
+    }
+}

Propchange: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/AdapterFactoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/AdapterFactoryTest.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Wed Oct 22 20:20:55 2014
@@ -0,0 +1 @@
+LastChangedDate LastChangedRevision LastChangedBy HeadURL Id Author

Propchange: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/AdapterFactoryTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ImplementsExtendsTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ImplementsExtendsTest.java?rev=1633709&r1=1633708&r2=1633709&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ImplementsExtendsTest.java (original)
+++ sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ImplementsExtendsTest.java Wed Oct 22 20:20:55 2014
@@ -17,8 +17,10 @@
 package org.apache.sling.models.impl;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyBoolean;
 import static org.mockito.Matchers.anyObject;
@@ -165,6 +167,7 @@ public class ImplementsExtendsTest {
         assertNotNull(model);
         assertEquals(ImplementsInterfacePropertyModel.class, model.getClass());
         assertEquals("first-value|null|third-value", model.getAllProperties());
+        assertTrue(factory.canCreateFromAdaptable(res, SampleServiceInterface.class));
     }
 
     /**
@@ -179,10 +182,12 @@ public class ImplementsExtendsTest {
         Resource res = getMockResourceWithProps();
         SampleServiceInterface model = factory.getAdapter(res, SampleServiceInterface.class);
         assertNull(model);
+        assertFalse(factory.isModelClass(res, SampleServiceInterface.class));
 
         model = factory.getAdapter(res, ImplementsInterfacePropertyModel.class);
         assertNotNull(model);
         assertEquals("first-value|null|third-value", model.getAllProperties());
+        assertTrue(factory.canCreateFromAdaptable(res, ImplementsInterfacePropertyModel.class));
     }
 
     /**
@@ -207,6 +212,7 @@ public class ImplementsExtendsTest {
         Resource res = getMockResourceWithProps();
         InvalidSampleServiceInterface model = factory.getAdapter(res, InvalidSampleServiceInterface.class);
         assertNull(model);
+        assertFalse(factory.isModelClass(res, InvalidSampleServiceInterface.class));
     }
 
     /**
@@ -219,10 +225,12 @@ public class ImplementsExtendsTest {
         SimplePropertyModel model = factory.getAdapter(res, SimplePropertyModel.class);
         assertNotNull(model);
         assertEquals("!first-value|null|third-value!", model.getAllProperties());
+        assertTrue(factory.canCreateFromAdaptable(res, SimplePropertyModel.class));
 
         EvenSimplerPropertyModel simplerModel = factory.getAdapter(res, EvenSimplerPropertyModel.class);
         assertNotNull(simplerModel);
         assertEquals("first-value", model.getFirst());
+        assertTrue(factory.canCreateFromAdaptable(res, EvenSimplerPropertyModel.class));
     }
 
     /**
@@ -237,6 +245,7 @@ public class ImplementsExtendsTest {
         assertNotNull(model);
         assertEquals(ImplementsInterfacePropertyModel2.class, model.getClass());
         assertEquals("first-value|null|third-value", model.getAllProperties());
+        assertTrue(factory.canCreateFromAdaptable(res, SampleServiceInterface.class));
     }
 
     private Resource getMockResourceWithProps() {

Added: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/ConstructorWithExceptionModel.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/ConstructorWithExceptionModel.java?rev=1633709&view=auto
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/ConstructorWithExceptionModel.java (added)
+++ sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/ConstructorWithExceptionModel.java Wed Oct 22 20:20:55 2014
@@ -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.testmodels.classes;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.models.annotations.Model;
+
+@Model(adaptables=Resource.class)
+public class ConstructorWithExceptionModel {
+    public ConstructorWithExceptionModel() {
+        throw new RuntimeException("Exception thrown in constructor");
+    }
+}

Propchange: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/ConstructorWithExceptionModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/ConstructorWithExceptionModel.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Wed Oct 22 20:20:55 2014
@@ -0,0 +1 @@
+LastChangedDate LastChangedRevision LastChangedBy HeadURL Id Author

Propchange: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/ConstructorWithExceptionModel.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/InvalidModelWithMissingAnnotation.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/InvalidModelWithMissingAnnotation.java?rev=1633709&view=auto
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/InvalidModelWithMissingAnnotation.java (added)
+++ sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/InvalidModelWithMissingAnnotation.java Wed Oct 22 20:20:55 2014
@@ -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.testmodels.classes;
+
+import javax.inject.Inject;
+
+public class InvalidModelWithMissingAnnotation {
+    
+    @Inject
+    private String attribute;
+    
+    public InvalidModelWithMissingAnnotation() {
+    }
+
+    public String getAttribute() {
+        return attribute;
+    }
+}

Propchange: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/InvalidModelWithMissingAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/InvalidModelWithMissingAnnotation.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Wed Oct 22 20:20:55 2014
@@ -0,0 +1 @@
+LastChangedDate LastChangedRevision LastChangedBy HeadURL Id Author

Propchange: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/InvalidModelWithMissingAnnotation.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain