Author: alien11689 Date: Wed Sep 27 19:23:55 2017 New Revision: 1809905 URL: http://svn.apache.org/viewvc?rev=1809905&view=rev Log: [ARIES-1741] Add itest for pax cdi annotations
Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/ aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/pom.xml aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/ aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/ aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/ aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/p1/ aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/p1/I1.java aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/p1/I2.java aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/p1/T1.java aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/verify.groovy Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/pom.xml URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/pom.xml?rev=1809905&view=auto ============================================================================== --- aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/pom.xml (added) +++ aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/pom.xml Wed Sep 27 19:23:55 2017 @@ -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. +--> +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.aries.blueprint.plugin.itest</groupId> + <artifactId>simple-project</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>jar</packaging> + + <dependencies> + <dependency> + <groupId>javax.inject</groupId> + <artifactId>javax.inject</artifactId> + <version>1</version> + </dependency> + <dependency> + <groupId>org.ops4j.pax.cdi</groupId> + <artifactId>pax-cdi-api</artifactId> + <version>0.8.0</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.aries.blueprint</groupId> + <artifactId>blueprint-maven-plugin</artifactId> + <version>@blueprint-maven-plugin.version@</version> + <executions> + <execution> + <goals> + <goal>add-resource-dir</goal> + <goal>blueprint-generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/p1/I1.java URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/p1/I1.java?rev=1809905&view=auto ============================================================================== --- aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/p1/I1.java (added) +++ aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/p1/I1.java Wed Sep 27 19:23:55 2017 @@ -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 + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package p1; + +public interface I1 {} \ No newline at end of file Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/p1/I2.java URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/p1/I2.java?rev=1809905&view=auto ============================================================================== --- aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/p1/I2.java (added) +++ aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/p1/I2.java Wed Sep 27 19:23:55 2017 @@ -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 + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package p1; + +public interface I2 {} \ No newline at end of file Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/p1/T1.java URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/p1/T1.java?rev=1809905&view=auto ============================================================================== --- aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/p1/T1.java (added) +++ aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/p1/T1.java Wed Sep 27 19:23:55 2017 @@ -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 + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package p1; + +import org.ops4j.pax.cdi.api.OsgiService; +import org.ops4j.pax.cdi.api.OsgiServiceProvider; +import org.ops4j.pax.cdi.api.Properties; +import org.ops4j.pax.cdi.api.Property; + +import javax.inject.Singleton; + +@Singleton +@OsgiServiceProvider +@Properties({ + @Property(name = "test1", value = "test"), +}) +public class T1 implements I1 { + + public T1(@OsgiService(filter="(a=1234)") I2 dependency) { + } +} \ No newline at end of file Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/verify.groovy URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/verify.groovy?rev=1809905&view=auto ============================================================================== --- aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/verify.groovy (added) +++ aries/trunk/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/verify.groovy Wed Sep 27 19:23:55 2017 @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +def file = new File(basedir, 'target/generated-sources/blueprint/OSGI-INF/blueprint/autowire.xml') +assert file.exists() +def xml = new groovy.util.XmlSlurper().parse(file) +assert xml.name() == 'blueprint' +assert xml.bean.find{ it.@class == 'p1.T1'}.@id == 't1' +assert xml.bean.find{ it.@class == 'p1.T1'}.argument.@ref == 'i2-a1234' +assert xml.service.find{ it.@ref == 't1'}.'service-properties'.entry.@key == 'test1' +assert xml.service.find{ it.@ref == 't1'}.'service-properties'.entry.@value == 'test' +assert xml.reference.find{ it.@id == 'i2-a1234'}.@interface == 'p1.I2' +assert xml.reference.find{ it.@id == 'i2-a1234'}.@filter == '(a=1234)'