Added: sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/CollectionOSGiModel.java URL: http://svn.apache.org/viewvc/sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/CollectionOSGiModel.java?rev=1552355&view=auto ============================================================================== --- sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/CollectionOSGiModel.java (added) +++ sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/CollectionOSGiModel.java Thu Dec 19 17:01:20 2013 @@ -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.yamf.testmodels.classes; + +import java.util.Collection; + +import javax.inject.Inject; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.yamf.api.Model; +import org.apache.sling.yamf.testmodels.interfaces.ServiceInterface; + +@Model(adaptables = Resource.class) +public class CollectionOSGiModel { + + @Inject + private Collection<ServiceInterface> services; + + public Collection<ServiceInterface> getServices() { + return services; + } + +}
Added: sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ListOSGiModel.java URL: http://svn.apache.org/viewvc/sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ListOSGiModel.java?rev=1552355&view=auto ============================================================================== --- sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ListOSGiModel.java (added) +++ sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ListOSGiModel.java Thu Dec 19 17:01:20 2013 @@ -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.yamf.testmodels.classes; + +import java.util.List; + +import javax.inject.Inject; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.yamf.api.Model; +import org.apache.sling.yamf.testmodels.interfaces.ServiceInterface; + +@Model(adaptables = Resource.class) +public class ListOSGiModel { + + @Inject + private List<ServiceInterface> services; + + public List<ServiceInterface> getServices() { + return services; + } + +} Added: sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ProjectionModel.java URL: http://svn.apache.org/viewvc/sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ProjectionModel.java?rev=1552355&view=auto ============================================================================== --- sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ProjectionModel.java (added) +++ sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ProjectionModel.java Thu Dec 19 17:01:20 2013 @@ -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.yamf.testmodels.classes; + +import javax.inject.Inject; + +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.yamf.api.Model; +import org.apache.sling.yamf.api.Projection; + +@Model(adaptables=SlingHttpServletRequest.class) +public class ProjectionModel { + + @Inject + @Projection("resource") + private String firstProperty; + + public String getFirstProperty() { + return firstProperty; + } + +} Added: sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ResourceModelWithRequiredField.java URL: http://svn.apache.org/viewvc/sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ResourceModelWithRequiredField.java?rev=1552355&view=auto ============================================================================== --- sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ResourceModelWithRequiredField.java (added) +++ sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ResourceModelWithRequiredField.java Thu Dec 19 17:01:20 2013 @@ -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.yamf.testmodels.classes; + +import javax.inject.Inject; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.yamf.api.Model; + +@Model(adaptables = Resource.class) +public class ResourceModelWithRequiredField { + + @Inject + private String required; + + public String getRequired() { + return required; + } + +} Added: sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SetOSGiModel.java URL: http://svn.apache.org/viewvc/sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SetOSGiModel.java?rev=1552355&view=auto ============================================================================== --- sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SetOSGiModel.java (added) +++ sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SetOSGiModel.java Thu Dec 19 17:01:20 2013 @@ -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.yamf.testmodels.classes; + +import java.util.Set; + +import javax.inject.Inject; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.yamf.api.Model; +import org.apache.sling.yamf.testmodels.interfaces.ServiceInterface; + +@Model(adaptables = Resource.class) +public class SetOSGiModel { + + @Inject + private Set<ServiceInterface> services; + + public Set<ServiceInterface> getServices() { + return services; + } + +} Added: sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SimpleOSGiModel.java URL: http://svn.apache.org/viewvc/sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SimpleOSGiModel.java?rev=1552355&view=auto ============================================================================== --- sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SimpleOSGiModel.java (added) +++ sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SimpleOSGiModel.java Thu Dec 19 17:01:20 2013 @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.yamf.testmodels.classes; + +import javax.inject.Inject; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.yamf.api.Model; +import org.apache.sling.yamf.testmodels.interfaces.ServiceInterface; + +@Model(adaptables = Resource.class) +public class SimpleOSGiModel { + + @Inject + private ServiceInterface service; + + public ServiceInterface getService() { + return service; + } + +} Added: sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SimplePropertyModel.java URL: http://svn.apache.org/viewvc/sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SimplePropertyModel.java?rev=1552355&view=auto ============================================================================== --- sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SimplePropertyModel.java (added) +++ sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SimplePropertyModel.java Thu Dec 19 17:01:20 2013 @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.yamf.testmodels.classes; + +import javax.annotation.PostConstruct; +import javax.inject.Inject; +import javax.inject.Named; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.yamf.api.Model; +import org.apache.sling.yamf.api.Optional; + +@Model(adaptables = Resource.class) +public class SimplePropertyModel { + + @Inject + private String first; + + @Inject + @Optional + private String second; + + @Inject + @Named("third") + private String thirdProperty; + + @Inject + private int intProperty; + + private boolean postConstructCalled; + + public int getIntProperty() { + return intProperty; + } + + public String getFirst() { + return first; + } + + public String getSecond() { + return second; + } + + public String getThirdProperty() { + return thirdProperty; + } + + @PostConstruct + protected void postConstruct() { + postConstructCalled = true; + } + + public boolean isPostConstructCalled() { + return postConstructCalled; + } + +} Added: sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SubClass.java URL: http://svn.apache.org/viewvc/sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SubClass.java?rev=1552355&view=auto ============================================================================== --- sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SubClass.java (added) +++ sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SubClass.java Thu Dec 19 17:01:20 2013 @@ -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.yamf.testmodels.classes; + +import javax.annotation.PostConstruct; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.yamf.api.Model; + +@Model(adaptables=Resource.class) +public class SubClass extends SuperClass { + + private long postConstructCalledTimestampInSub; + + public long getPostConstructCalledTimestampInSub() { + return postConstructCalledTimestampInSub; + } + + @PostConstruct + protected void pc2() { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + postConstructCalledTimestampInSub = System.currentTimeMillis(); + } +} Added: sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SuperClass.java URL: http://svn.apache.org/viewvc/sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SuperClass.java?rev=1552355&view=auto ============================================================================== --- sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SuperClass.java (added) +++ sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/SuperClass.java Thu Dec 19 17:01:20 2013 @@ -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.yamf.testmodels.classes; + +import javax.annotation.PostConstruct; + +public class SuperClass { + + private long postConstructCalledTimestampInSuper; + + public long getPostConstructCalledTimestampInSuper() { + return postConstructCalledTimestampInSuper; + } + + @PostConstruct + protected void pc() { + postConstructCalledTimestampInSuper = System.currentTimeMillis(); + } + +} Added: sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/interfaces/ResourceModelWithRequiredField.java URL: http://svn.apache.org/viewvc/sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/interfaces/ResourceModelWithRequiredField.java?rev=1552355&view=auto ============================================================================== --- sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/interfaces/ResourceModelWithRequiredField.java (added) +++ sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/interfaces/ResourceModelWithRequiredField.java Thu Dec 19 17:01:20 2013 @@ -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.yamf.testmodels.interfaces; + +import javax.inject.Inject; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.yamf.api.Model; + +@Model(adaptables = Resource.class) +public interface ResourceModelWithRequiredField { + + @Inject + public String getRequired(); + +} Added: sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/interfaces/ServiceInterface.java URL: http://svn.apache.org/viewvc/sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/interfaces/ServiceInterface.java?rev=1552355&view=auto ============================================================================== --- sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/interfaces/ServiceInterface.java (added) +++ sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/interfaces/ServiceInterface.java Thu Dec 19 17:01:20 2013 @@ -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.yamf.testmodels.interfaces; + +public interface ServiceInterface { + +} Added: sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/interfaces/SimplePropertyModel.java URL: http://svn.apache.org/viewvc/sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/interfaces/SimplePropertyModel.java?rev=1552355&view=auto ============================================================================== --- sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/interfaces/SimplePropertyModel.java (added) +++ sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/interfaces/SimplePropertyModel.java Thu Dec 19 17:01:20 2013 @@ -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.yamf.testmodels.interfaces; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.yamf.api.Model; +import org.apache.sling.yamf.api.Optional; + +@Model(adaptables = Resource.class) +public interface SimplePropertyModel { + + @Inject + public String getFirst(); + + @Inject + @Optional + public String getSecond(); + + @Inject + @Named("third") + public String getThirdProperty(); + +} Added: sling/whiteboard/justin/yamf/org.apache.sling.yamf.server-side-tests/pom.xml URL: http://svn.apache.org/viewvc/sling/whiteboard/justin/yamf/org.apache.sling.yamf.server-side-tests/pom.xml?rev=1552355&view=auto ============================================================================== --- sling/whiteboard/justin/yamf/org.apache.sling.yamf.server-side-tests/pom.xml (added) +++ sling/whiteboard/justin/yamf/org.apache.sling.yamf.server-side-tests/pom.xml Thu Dec 19 17:01:20 2013 @@ -0,0 +1,152 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor + license agreements. See the NOTICE file distributed with this work for additional + information regarding copyright ownership. The ASF licenses this file to + you under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of + the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.sling</groupId> + <artifactId>sling</artifactId> + <version>18</version> + </parent> + <artifactId>org.apache.sling.yamf.server-side-tests</artifactId> + <packaging>bundle</packaging> + <version>0.0.1-SNAPSHOT</version> + <name>org.apache.sling.yamf.server-side-tests</name> + <description>org.apache.sling - org.apache.sling.yamf.server-side-tests</description> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-scr-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Sling-YAMF-Packages> + org.apache.sling.yamf.it.models + </Sling-YAMF-Packages> + <Sling-Test-Regexp>.*Test</Sling-Test-Regexp> + <Export-Package>org.apache.sling.yamf.it</Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.yamf.api</artifactId> + <version>0.0.1-SNAPSHOT</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.compendium</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.core</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.api</artifactId> + <version>2.2.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.scr.annotations</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.8.2</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.junit.core</artifactId> + <version>1.0.8</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.jcr</groupId> + <artifactId>jcr</artifactId> + </dependency> + <dependency> + <groupId>javax.inject</groupId> + <artifactId>javax.inject</artifactId> + <version>1</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.commons.osgi</artifactId> + <version>2.2.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.5</version> + <scope>provided</scope> + </dependency> + </dependencies> + <profiles> + <profile> + <id>autoInstallBundle</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.sling</groupId> + <artifactId>maven-sling-plugin</artifactId> + <version>2.0.4-incubator</version> + <executions> + <execution> + <id>install-bundle</id> + <goals> + <goal>install</goal> + </goals> + <configuration> + <slingUrl>http://localhost:8888/system/console</slingUrl> + <user>admin</user> + <password>admin</password> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> +</project> Added: sling/whiteboard/justin/yamf/org.apache.sling.yamf.server-side-tests/src/main/java/org/apache/sling/yamf/it/SimpleTest.java URL: http://svn.apache.org/viewvc/sling/whiteboard/justin/yamf/org.apache.sling.yamf.server-side-tests/src/main/java/org/apache/sling/yamf/it/SimpleTest.java?rev=1552355&view=auto ============================================================================== --- sling/whiteboard/justin/yamf/org.apache.sling.yamf.server-side-tests/src/main/java/org/apache/sling/yamf/it/SimpleTest.java (added) +++ sling/whiteboard/justin/yamf/org.apache.sling.yamf.server-side-tests/src/main/java/org/apache/sling/yamf/it/SimpleTest.java Thu Dec 19 17:01:20 2013 @@ -0,0 +1,51 @@ +package org.apache.sling.yamf.it; + +import static org.junit.Assert.*; + +import javax.jcr.Node; +import javax.jcr.Session; + +import org.apache.commons.lang.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.annotations.SlingAnnotationsTestRunner; +import org.apache.sling.junit.annotations.TestReference; +import org.apache.sling.yamf.it.models.TestModel; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@RunWith(SlingAnnotationsTestRunner.class) +public class SimpleTest { + + @TestReference + private ResourceResolverFactory rrFactory; + + @Test + public void test() throws Exception { + String value = RandomStringUtils.randomAlphanumeric(10); + + ResourceResolver resolver = null; + try { + resolver = rrFactory.getAdministrativeResourceResolver(null); + Session session = resolver.adaptTo(Session.class); + Node rootNode = session.getRootNode(); + Node node = rootNode.addNode("test_" + RandomStringUtils.randomAlphanumeric(10)); + node.setProperty("testProperty", value); + session.save(); + + Resource resource = resolver.getResource(node.getPath()); + + TestModel model = resource.adaptTo(TestModel.class); + + assertNotNull("Model is null", model); + assertEquals("Test Property is not set correctly", value, model.getTestProperty()); + } finally { + if (resolver != null) { + resolver.close(); + } + } + } +} Added: sling/whiteboard/justin/yamf/org.apache.sling.yamf.server-side-tests/src/main/java/org/apache/sling/yamf/it/models/TestModel.java URL: http://svn.apache.org/viewvc/sling/whiteboard/justin/yamf/org.apache.sling.yamf.server-side-tests/src/main/java/org/apache/sling/yamf/it/models/TestModel.java?rev=1552355&view=auto ============================================================================== --- sling/whiteboard/justin/yamf/org.apache.sling.yamf.server-side-tests/src/main/java/org/apache/sling/yamf/it/models/TestModel.java (added) +++ sling/whiteboard/justin/yamf/org.apache.sling.yamf.server-side-tests/src/main/java/org/apache/sling/yamf/it/models/TestModel.java Thu Dec 19 17:01:20 2013 @@ -0,0 +1,17 @@ +package org.apache.sling.yamf.it.models; + +import javax.inject.Inject; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.yamf.api.Model; + +@Model(adaptables=Resource.class) +public class TestModel { + + @Inject + private String testProperty; + + public String getTestProperty() { + return testProperty; + } +}
