From 9425990f532b1152c2d73db96c0f07ef5216a3d1 Mon Sep 17 00:00:00 2001 From: lresende Date: Thu, 12 Nov 2009 00:43:48 +0000 Subject: Moving 2.x contribs git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835178 13f79535-47bb-0310-9956-ffa450edef68 --- .../vtest/java-api/annotations/property/pom.xml | 46 ---- .../javaapi/annotations/property/AService.java | 82 ------ .../annotations/property/AnotherAService.java | 48 ---- .../javaapi/annotations/property/BService.java | 32 --- .../javaapi/annotations/property/CService.java | 38 --- .../javaapi/annotations/property/impl/AObject.java | 35 --- .../annotations/property/impl/AServiceImpl.java | 240 ----------------- .../property/impl/AnotherAServiceImpl.java | 116 -------- .../annotations/property/impl/BServiceImpl.java | 32 --- .../annotations/property/impl/CServiceImpl1.java | 87 ------ .../annotations/property/impl/CServiceImpl2.java | 87 ------ .../annotations/property/impl/CServiceImpl3.java | 87 ------ .../annotations/property/impl/CServiceImpl4.java | 88 ------ .../annotations/property/impl/CServiceImpl5.java | 88 ------ .../annotations/property/impl/CServiceImpl6.java | 88 ------ .../property/src/main/resources/property.composite | 143 ---------- .../property/PropertyAnnotationTestCase.java | 299 --------------------- 17 files changed, 1636 deletions(-) delete mode 100644 java/sca-contrib/vtest/java-api/annotations/property/pom.xml delete mode 100644 java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AService.java delete mode 100644 java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AnotherAService.java delete mode 100644 java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/BService.java delete mode 100644 java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/CService.java delete mode 100644 java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AObject.java delete mode 100644 java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AServiceImpl.java delete mode 100644 java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AnotherAServiceImpl.java delete mode 100644 java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/BServiceImpl.java delete mode 100644 java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl1.java delete mode 100644 java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl2.java delete mode 100644 java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl3.java delete mode 100644 java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl4.java delete mode 100644 java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl5.java delete mode 100644 java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl6.java delete mode 100644 java/sca-contrib/vtest/java-api/annotations/property/src/main/resources/property.composite delete mode 100644 java/sca-contrib/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java (limited to 'java/sca-contrib/vtest/java-api/annotations/property') diff --git a/java/sca-contrib/vtest/java-api/annotations/property/pom.xml b/java/sca-contrib/vtest/java-api/annotations/property/pom.xml deleted file mode 100644 index 0c36e98879..0000000000 --- a/java/sca-contrib/vtest/java-api/annotations/property/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - java-api-annotations - 2.0-SNAPSHOT - ../pom.xml - - vtest-java-api-annotations-property - Apache Tuscany SCA Java APIs and Annotations Verification Tests - Annotations - @Property - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AService.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AService.java deleted file mode 100644 index 5cfea1b099..0000000000 --- a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AService.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.vtest.javaapi.annotations.property; - -/** - * Simple Service - */ -public interface AService { - - public String getName(); - - public String getP1(); - - public String getP2(); - - public String getP3(); - - public String getP4(); - - public String getP5(); - - public String getP6(); - - public String getP7AString(); - - public int getP7BInt(); - - public String getP8AString(); - - public int getP8BInt(); - - public String getP9AString(); - - public int getP9BInt(); - - public String getP10AString(); - - public int getP10BInt(); - - public String getP11AString(); - - public int getP11BInt(); - - public String getP12AString(); - - public int getP12BInt(); - - public String getP15(); - - public String getP16(); - - public String getP17(); - - public String getP18(); - - public int getP19Size(); - - public String getP20(int i); - - public int getP20Size(); - - public int getP21(int i); - - public int getP21Size(); - -} diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AnotherAService.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AnotherAService.java deleted file mode 100644 index 5ddc59f8b6..0000000000 --- a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AnotherAService.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.vtest.javaapi.annotations.property; - -/** - * Simple Service - */ -public interface AnotherAService { - - public String getName(); - - public String getP13(); - - public String getP14(); - - public String getP22(); - - public String getP23(); - - public String getP24(); - - public String getP25(); - - public boolean getP14SetterIsCalled(); - - public boolean getP23SetterIsCalled(); - - public boolean getP24SetterIsCalled(); - - public boolean getP25SetterIsCalled(); - -} diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/BService.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/BService.java deleted file mode 100644 index c39d4e2504..0000000000 --- a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/BService.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.vtest.javaapi.annotations.property; - -import org.oasisopen.sca.annotation.Remotable; - - -/** - * Simple Service used by another service - */ -@Remotable -public interface BService { - - String getName(); - -} diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/CService.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/CService.java deleted file mode 100644 index 5de3b5fcff..0000000000 --- a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/CService.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.vtest.javaapi.annotations.property; - - -/** - * Simple Service used by another service - */ -public interface CService { - - String getName(); - - public String getB1Name(); - - public String getP2(); - - public int getP3(); - - public String getP4(); - - public String getConstructor(); -} diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AObject.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AObject.java deleted file mode 100644 index f30c4c69fc..0000000000 --- a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AObject.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl; - -/** - * A simple object to hold a string - */ -public class AObject { - - public String aString; - public int bInt; - - public AObject() { - this.aString = null; - this.bInt = 0; - } - -} diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AServiceImpl.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AServiceImpl.java deleted file mode 100644 index 6dd91b598d..0000000000 --- a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AServiceImpl.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl; - -import java.util.List; - -import org.apache.tuscany.sca.vtest.javaapi.annotations.property.AService; -import org.oasisopen.sca.annotation.Service; -import org.oasisopen.sca.annotation.Property; - -@Service(AService.class) -public class AServiceImpl implements AService { - - @Property - protected String p1; // simple Java type injected via field - - @Property - public String p2; // simple Java type injected via field - - protected String p3; // simple Java type injected via setter - - public String p4; // simple Java type injected via setter - - protected String p5; // simple Java type injected via constructor parameter - - public String p6; // simple Java type injected via constructor parameter - - @Property(required=true) - protected AObject p7; // complex Java type injected via field - - @Property - public AObject p8; // complex Java type injected via field - - protected AObject p9; // complex Java type injected via setter - - public AObject p10; // complex Java type injected via setter - - protected AObject p11; // complex Java type injected via constructor parameter - - public AObject p12; // complex Java type injected via constructor parameter - - @Property(name="pFifteen") - protected String p15; // injected via field with different name - - protected String p16; // injected via setter with different name - - @Property(name="p17", required=false) - public String p17; // injected via field but not defined in composite - - public String p18; // injected via setter but not defined in composite - - @Property(name="p19", required=true) - public List p19; // a List and injected via field with no element - - public List p20; // a List and injected via setter - - @Property(required=false) - public Integer[] p21; // an array and injected via field - - public String getName() { - return "AService"; - } - - public AServiceImpl( - @Property(name = "p5") String p5, - @Property(name = "p6") String p6, - @Property(name = "p11") AObject p11, - @Property(name = "p12") AObject p12 - ) { - super(); - this.p5 = p5; - this.p6 = p6; - this.p11 = p11; - this.p12 = p12; - } - - @Property - public void setP3(String p3) { - this.p3 = p3; - } - - @Property(required=true) - public void setP4(String p4) { - this.p4 = p4; - } - - @Property - public void setP9(AObject p9) { - this.p9 = p9; - } - - @Property - public void setP10(AObject p10) { - this.p10 = p10; - } - - @Property(name="pSixteen") - public void setP16(String p16) { - this.p16 = p16; - } - - @Property(name="p18", required=false) - public void setP18(String p18) { - this.p18 = p18; - } - - @Property(name="p20", required=true) - public void setP20(List p20) { - this.p20 = p20; - } - - public String getP1() { - return p1; - } - - public String getP2() { - return p2; - } - - public String getP3() { - return p3; - } - - public String getP4() { - return p4; - } - - public String getP5() { - return p5; - } - - public String getP6() { - return p6; - } - - public String getP7AString() { - return p7.aString; - } - - public int getP7BInt() { - return p7.bInt; - } - - public String getP8AString() { - return p8.aString; - } - - public int getP8BInt() { - return p8.bInt; - } - - public String getP9AString() { - return p9.aString; - } - - public int getP9BInt() { - return p9.bInt; - } - - public String getP10AString() { - return p10.aString; - } - - public int getP10BInt() { - return p10.bInt; - } - - public String getP11AString() { - return p11.aString; - } - - public int getP11BInt() { - return p11.bInt; - } - - public String getP12AString() { - return p12.aString; - } - - public int getP12BInt() { - return p12.bInt; - } - - public String getP15() { - return p15; - } - - public String getP16() { - return p16; - } - - public String getP17() { - return p17; - } - - public String getP18() { - return p18; - } - - public int getP19Size() { - return p19.size(); - } - - public String getP20(int i) { - return p20.get(i); - } - - public int getP20Size() { - return p20.size(); - } - - public int getP21(int i) { - return p21[i].intValue(); - } - - public int getP21Size() { - return p21.length; - } - -} - - - diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AnotherAServiceImpl.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AnotherAServiceImpl.java deleted file mode 100644 index b6d51ef253..0000000000 --- a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AnotherAServiceImpl.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl; - -import org.apache.tuscany.sca.vtest.javaapi.annotations.property.AnotherAService; -import org.oasisopen.sca.annotation.Service; - -@Service(AnotherAService.class) -public class AnotherAServiceImpl implements AnotherAService { - - public String p13; // injected via field and un-annotated - - public String p14; // injected via setter and un-annotated - - protected String p22; // unannotated protected field should not be injected - - protected String p23; // un-annotated protected and has protected setter - - protected String p24; // un-annotated protected field and has public setter - - private String p25; // un-annotated private field and has public setter - - public boolean p14SetterIsCalled = false; - - public boolean p23SetterIsCalled = false; - - public boolean p24SetterIsCalled = false; - - public boolean p25SetterIsCalled = false; - - - public String getName() { - return "AService"; - } - - public void setP14(String p14) { - p14SetterIsCalled = true; - this.p14 = p14; - } - - protected void setP23(String p23) { - p23SetterIsCalled = true; - this.p23 = p23; - } - - public void setP24(String p24) { - p24SetterIsCalled = true; - this.p24 = p24; - } - - public void setP25(String p25) { - p25SetterIsCalled = true; - this.p25 = p25; - } - - public String getP13() { - return p13; - } - - public String getP14() { - return p14; - } - - public String getP22() { - return p22; - } - - public String getP23() { - return p23; - } - - public String getP24() { - return p24; - } - - public String getP25() { - return p25; - } - - public boolean getP14SetterIsCalled() { - return p14SetterIsCalled; - } - - - public boolean getP23SetterIsCalled() { - return p23SetterIsCalled; - } - - - public boolean getP24SetterIsCalled() { - return p24SetterIsCalled; - } - - - public boolean getP25SetterIsCalled() { - return p25SetterIsCalled; - } - -} diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/BServiceImpl.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/BServiceImpl.java deleted file mode 100644 index d6a36f54a9..0000000000 --- a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/BServiceImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl; - -import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService; -import org.oasisopen.sca.annotation.Service; - -@Service(BService.class) -public class BServiceImpl implements BService { - - public String getName() { - return "BService"; - } - -} diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl1.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl1.java deleted file mode 100644 index ace9da2904..0000000000 --- a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl1.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl; - -import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService; -import org.apache.tuscany.sca.vtest.javaapi.annotations.property.CService; -import org.oasisopen.sca.annotation.Constructor; -import org.oasisopen.sca.annotation.Property; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Service; - -@Service(CService.class) -public class CServiceImpl1 implements CService { - - public BService b1; - - public String p2; - - public int p3; - - public String p4; - - public String constructor; - - @Constructor - public CServiceImpl1() { - constructor = "NoArgument"; - } - - public CServiceImpl1(@Reference(name = "bOne") BService b1, @Property(name = "pTwo") String p2, @Property(name = "pThree") int p3, @Property(name = "pFour") String p4) { - this.b1 = b1; - this.p2 = p2; - this.p3 = p3; - this.p4 = p4; - constructor = "AllArguments"; - } - - public CServiceImpl1(BService bOne, String pTwo, int pThree) { - this.b1 = bOne; - this.p2 = pTwo; - this.p3 = pThree; - constructor = "LessArguments"; - } - - public String getName() { - return "BService"; - } - - public String getB1Name() { - if (b1 == null) - return null; - return b1.getName(); - } - - public String getP2() { - return p2; - } - - public int getP3() { - return p3; - } - - public String getConstructor() { - return constructor; - } - - public String getP4() { - return p4; - } -} diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl2.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl2.java deleted file mode 100644 index 4396b6ce32..0000000000 --- a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl2.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl; - -import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService; -import org.apache.tuscany.sca.vtest.javaapi.annotations.property.CService; -import org.oasisopen.sca.annotation.Constructor; -import org.oasisopen.sca.annotation.Property; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Service; - -@Service(CService.class) -public class CServiceImpl2 implements CService { - - public BService b1; - - public String p2; - - public int p3; - - public String p4; - - public String constructor; - - public CServiceImpl2() { - constructor = "NoArgument"; - } - - @Constructor() - public CServiceImpl2(@Reference(name = "bOne") BService b1, @Property(name = "pTwo") String p2, @Property(name = "pThree") int p3, @Property(name = "pFour") String p4) { - this.b1 = b1; - this.p2 = p2; - this.p3 = p3; - this.p4 = p4; - constructor = "AllArguments"; - } - - public CServiceImpl2(BService bOne, String pTwo, int pThree) { - this.b1 = bOne; - this.p2 = pTwo; - this.p3 = pThree; - constructor = "LessArguments"; - } - - public String getName() { - return "BService"; - } - - public String getB1Name() { - if (b1 == null) - return null; - return b1.getName(); - } - - public String getP2() { - return p2; - } - - public int getP3() { - return p3; - } - - public String getConstructor() { - return constructor; - } - - public String getP4() { - return p4; - } -} diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl3.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl3.java deleted file mode 100644 index cd459f2dd1..0000000000 --- a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl3.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl; - -import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService; -import org.apache.tuscany.sca.vtest.javaapi.annotations.property.CService; -import org.oasisopen.sca.annotation.Constructor; -import org.oasisopen.sca.annotation.Property; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Service; - -@Service(CService.class) -public class CServiceImpl3 implements CService { - - public BService b1; - - public String p2; - - public int p3; - - public String p4; - - public String constructor; - - public CServiceImpl3() { - constructor = "NoArgument"; - } - - @Constructor({"bOne", "pTwo", "pThree", "pFour"}) - public CServiceImpl3(@Reference(name = "bOne") BService b1, @Property(name = "pTwo") String p2, @Property(name = "pThree") int p3, @Property(name = "pFour") String p4) { - this.b1 = b1; - this.p2 = p2; - this.p3 = p3; - this.p4 = p4; - constructor = "AllArguments"; - } - - public CServiceImpl3(BService bOne, String pTwo, int pThree) { - this.b1 = bOne; - this.p2 = pTwo; - this.p3 = pThree; - constructor = "LessArguments"; - } - - public String getName() { - return "BService"; - } - - public String getB1Name() { - if (b1 == null) - return null; - return b1.getName(); - } - - public String getP2() { - return p2; - } - - public int getP3() { - return p3; - } - - public String getConstructor() { - return constructor; - } - - public String getP4() { - return p4; - } -} diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl4.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl4.java deleted file mode 100644 index c22ee08f95..0000000000 --- a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl4.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl; - -import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService; -import org.apache.tuscany.sca.vtest.javaapi.annotations.property.CService; -import org.oasisopen.sca.annotation.Constructor; -import org.oasisopen.sca.annotation.Property; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Service; - -@Service(CService.class) -public class CServiceImpl4 implements CService { - - public BService b1; - - public String p2; - - public int p3; - - public String p4; - - public String constructor; - - public CServiceImpl4() { - constructor = "NoArgument"; - } - - public CServiceImpl4(@Reference(name = "bOne") BService b1, @Property(name = "pTwo") String p2, @Property(name = "pThree") int p3, @Property(name = "pFour") String p4, int extra) { - this.b1 = b1; - this.p2 = p2; - this.p3 = p3; - this.p4 = p4; - constructor = "ExtraArguments"; - } - - @Constructor({"bOne", "pTwo", "pThree", "pFour"}) - public CServiceImpl4(BService bOne, String pTwo, int pThree, String pFour) { - this.b1 = bOne; - this.p2 = pTwo; - this.p3 = pThree; - this.p4 = pFour; - constructor = "AllArguments"; - } - - public String getName() { - return "BService"; - } - - public String getB1Name() { - if (b1 == null) - return null; - return b1.getName(); - } - - public String getP2() { - return p2; - } - - public int getP3() { - return p3; - } - - public String getConstructor() { - return constructor; - } - - public String getP4() { - return p4; - } -} diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl5.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl5.java deleted file mode 100644 index 02892ca7f3..0000000000 --- a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl5.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl; - -import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService; -import org.apache.tuscany.sca.vtest.javaapi.annotations.property.CService; -import org.oasisopen.sca.annotation.Constructor; -import org.oasisopen.sca.annotation.Property; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Service; - -@Service(CService.class) -public class CServiceImpl5 implements CService { - - public BService b1; - - public String p2; - - public int p3; - - public String p4; - - public String constructor; - - public CServiceImpl5() { - constructor = "NoArgument"; - } - - public CServiceImpl5(@Reference(name = "bOne") BService b1, @Property(name = "pTwo") String p2, @Property(name = "pThree") int p3, @Property(name = "pFour") String p4, int extra) { - this.b1 = b1; - this.p2 = p2; - this.p3 = p3; - this.p4 = p4; - constructor = "ExtraArguments"; - } - - @Constructor({"bOne", "pFour", "pThree", "pTwo"}) - public CServiceImpl5(BService bOne, String pTwo, int pThree, String pFour) { - this.b1 = bOne; - this.p2 = pTwo; - this.p3 = pThree; - this.p4 = pFour; - constructor = "SwitchedValues"; - } - - public String getName() { - return "BService"; - } - - public String getB1Name() { - if (b1 == null) - return null; - return b1.getName(); - } - - public String getP2() { - return p2; - } - - public int getP3() { - return p3; - } - - public String getConstructor() { - return constructor; - } - - public String getP4() { - return p4; - } -} diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl6.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl6.java deleted file mode 100644 index ed2c3dc365..0000000000 --- a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl6.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl; - -import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService; -import org.apache.tuscany.sca.vtest.javaapi.annotations.property.CService; -import org.oasisopen.sca.annotation.Constructor; -import org.oasisopen.sca.annotation.Property; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Service; - -@Service(CService.class) -public class CServiceImpl6 implements CService { - - public BService b1; - - public String p2; - - public int p3; - - public String p4; - - public String constructor; - - public CServiceImpl6() { - constructor = "NoArgument"; - } - - public CServiceImpl6(@Reference(name = "bOne") BService b1, @Property(name = "pTwo") String p2, @Property(name = "pThree") int p3, @Property(name = "pFour") String p4, int extra) { - this.b1 = b1; - this.p2 = p2; - this.p3 = p3; - this.p4 = p4; - constructor = "ExtraArguments"; - } - - @Constructor({"bOne", "pTwo", "pThree", "pWrong"}) - public CServiceImpl6(BService bOne, String pTwo, int pThree, String pFour) { - this.b1 = bOne; - this.p2 = pTwo; - this.p3 = pThree; - this.p4 = pFour; - constructor = "WrongValues"; - } - - public String getName() { - return "BService"; - } - - public String getB1Name() { - if (b1 == null) - return null; - return b1.getName(); - } - - public String getP2() { - return p2; - } - - public int getP3() { - return p3; - } - - public String getConstructor() { - return constructor; - } - - public String getP4() { - return p4; - } -} diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/resources/property.composite b/java/sca-contrib/vtest/java-api/annotations/property/src/main/resources/property.composite deleted file mode 100644 index f7af170f33..0000000000 --- a/java/sca-contrib/vtest/java-api/annotations/property/src/main/resources/property.composite +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - p1 - p2 - p3 - p4 - p5 - p6 - - - p7.aString - 7 - - - - - p8.aString - 8 - - - - - p9.aString - 9 - - - - - p10.aString - 10 - - - - - p11.aString - 11 - - - - - p12.aString - 12 - - - p15 - p16 - - "p20" - 2 1 21 - - - - - - p2 - 3 - p4 - - - - - - p2 - 3 - p4 - - - - - - p2 - 3 - p4 - - - - - - p2 - 3 - p4 - - - - - - p2 - 3 - p4 - - - - - - p2 - 3 - p4 - - - - - - - - - p13 - p14 - p22 - p23 - p24 - p25 - - diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java b/java/sca-contrib/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java deleted file mode 100644 index d5fbc568f7..0000000000 --- a/java/sca-contrib/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.vtest.javaapi.annotations.property; - -import static org.junit.Assert.fail; -import junit.framework.Assert; - -import org.apache.tuscany.sca.vtest.utilities.ServiceFinder; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; - -/** - * This test class tests the Property annotation described in section 1.2.3 - * including 1.8.5 and 1.8.13 - */ -public class PropertyAnnotationTestCase { - - protected static String compositeName = "property.composite"; - protected static AService aService = null; - protected static CService cService1 = null; - protected static CService cService2 = null; - protected static CService cService3 = null; - protected static CService cService4 = null; - protected static CService cService5 = null; - protected static CService cService6 = null; - protected static AnotherAService anotherAService = null; - - @BeforeClass - public static void init() throws Exception { - try { - System.out.println("Setting up"); - ServiceFinder.init(compositeName); - aService = ServiceFinder.getService(AService.class, "AComponent"); - cService1 = ServiceFinder.getService(CService.class, "CComponent1"); - cService2 = ServiceFinder.getService(CService.class, "CComponent2"); - cService3 = ServiceFinder.getService(CService.class, "CComponent3"); - cService4 = ServiceFinder.getService(CService.class, "CComponent4"); - cService5 = ServiceFinder.getService(CService.class, "CComponent5"); - cService6 = ServiceFinder.getService(CService.class, "CComponent6"); - anotherAService = ServiceFinder.getService(AnotherAService.class, "AnotherAComponent"); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - @AfterClass - public static void destroy() throws Exception { - - System.out.println("Cleaning up"); - ServiceFinder.cleanup(); - - } - - /** - * Lines 1343 to 1348:
- * The "@Property" annotation type is used to annotate a Java class field or - * a setter method that is used to inject an SCA property value. The type of - * the property injected, which can be a simple Java type or a complex Java - * type, is defined by the type of the Java class field or the type of the - * setter method input argument.
- * The "@Property" annotation may be used on protected or public fields and - * on setter methods or on a constructor method.
- *

- * p1 - simple Java type injected via field
- * p2 - simple Java type injected via field
- * p3 - simple Java type injected via setter
- * p4 - simple Java type injected via setter and required=true
- * p5 - simple Java type injected via constructor parameter
- * p6 - simple Java type injected via constructor parameter
- * p7 - complex Java type injected via field and required=true
- * p8 - complex Java type injected via field
- * p9 - complex Java type injected via setter
- * p10 - complex Java type injected via setter
- * p11 - complex Java type injected via constructor parameter
- * p12 - complex Java type injected via constructor parameter
- */ - @Test - public void atProperty1() throws Exception { - Assert.assertEquals("p1", aService.getP1()); - Assert.assertEquals("p2", aService.getP2()); - Assert.assertEquals("p3", aService.getP3()); - Assert.assertEquals("p4", aService.getP4()); - Assert.assertEquals("p5", aService.getP5()); - Assert.assertEquals("p6", aService.getP6()); - Assert.assertEquals("p7.aString", aService.getP7AString()); - Assert.assertEquals(7, aService.getP7BInt()); - Assert.assertEquals("p8.aString", aService.getP8AString()); - Assert.assertEquals(8, aService.getP8BInt()); - Assert.assertEquals("p9.aString", aService.getP9AString()); - Assert.assertEquals(9, aService.getP9BInt()); - Assert.assertEquals("p10.aString", aService.getP10AString()); - Assert.assertEquals(10, aService.getP10BInt()); - Assert.assertEquals("p11.aString", aService.getP11AString()); - Assert.assertEquals(11, aService.getP11BInt()); - Assert.assertEquals("p12.aString", aService.getP12AString()); - Assert.assertEquals(12, aService.getP12BInt()); - } - - /** - * Lines 1349 to 1352:
- * Properties may also be injected via public setter methods even when the - * "@Property" annotation is not present. However, the - * - * @Property annotation must be used in order to inject a property onto a - * non-public field. In the case where there is no "@Property" - * annotation, the name of the property is the same as the name of - * the field or setter.
- *

- * p13 is an un-annotated public field which should be injected - * via field
- */ - @Test - public void atProperty2() throws Exception { - Assert.assertEquals("p13", anotherAService.getP13()); - } - - /** - * Line 1353:
- * Where there is both a setter method and a field for a property, the - * setter method is used.
- *

- * p14 is an un-annotated public field, it should be injected via public - * setter
- */ - @Test - public void atProperty3() throws Exception { - Assert.assertEquals("p14", anotherAService.getP14()); - Assert.assertTrue(anotherAService.getP14SetterIsCalled()); - } - - /** - * Lines 1355 to 1357:
- * The "@Property" annotation has the following attributes:
- *

  • name (optional) – the name of the property, defaults to the name of - * the field of the Java class
  • - *
  • required (optional) – specifies whether injection is required, - * defaults to false
  • - *

    - * p15 - injected via field with different name "pFifteen"
    - * p16 - injected via setter with different name "pSixteen"
    - * p17 - injected via field but not defined in composite
    - * p18 - injected via setter but not defined in composite
    - * - * @TODO - Need to test required=true but not defined in composite (The - * specification does not describe the proper behaviour in this - * situation.) - */ - @Test - public void atProperty4() throws Exception { - Assert.assertEquals("p15", aService.getP15()); - Assert.assertEquals("p16", aService.getP16()); - Assert.assertNull(aService.getP17()); - Assert.assertNull(aService.getP18()); - } - - /** - * Lines 1369 to 1370:
    - * If the property is defined as an array or as a java.util.Collection, then - * the implied component type has a property with a many attribute set to - * true.
    - *

    - * p19 - a List and injected via field with no element
    - * p20 - a List and injected via setter
    - * p21 - an array and injected via field
    - */ - @Test - public void atProperty5() throws Exception { - Assert.assertEquals(0, aService.getP19Size()); - Assert.assertEquals(1, aService.getP20Size()); - Assert.assertEquals("p20", aService.getP20(0)); - Assert.assertEquals(3, aService.getP21Size()); - Assert.assertEquals(2, aService.getP21(0)); - Assert.assertEquals(1, aService.getP21(1)); - Assert.assertEquals(21, aService.getP21(2)); - } - - /** - * Lines 1141 to 1162:
    - * 1.8.5. "@Constructor"
    - * ...
    - * The "@Constructor" annotation is used to mark a particular constructor to - * use when instantiating a Java component implementation.
    - * The "@Constructor" annotation has the following attribute:
    - *

  • value (optional) – identifies the property/reference names that - * correspond to each of the constructor arguments. The position in the - * array determines which of the arguments are being named.
  • - *

    - * cService1 - "@Constructor" without value and constructor arguments
    - * cService2 - "@Constructor" without value but with constructor arguments
    - * cService3 - "@Constructor" with values and constructor arguments
    - * cService4 - "@Constructor" with values and constructor arguments where - * value, property and parameter names are same
    - * cService5 - "@Constructor" with switched values and constructor arguments
    - * cService6 - "@Constructor" with wrong values
    - */ - @Test - public void atProperty6() throws Exception { - Assert.assertNull(cService1.getB1Name()); - Assert.assertNull(cService1.getP2()); - Assert.assertEquals(0, cService1.getP3()); - Assert.assertNull(cService1.getP4()); - Assert.assertEquals("NoArgument", cService1.getConstructor()); - - Assert.assertEquals("BService", cService2.getB1Name()); - Assert.assertEquals("p2", cService2.getP2()); - Assert.assertEquals(3, cService2.getP3()); - Assert.assertEquals("p4", cService2.getP4()); - Assert.assertEquals("AllArguments", cService2.getConstructor()); - - Assert.assertEquals("BService", cService3.getB1Name()); - Assert.assertEquals("p2", cService3.getP2()); - Assert.assertEquals(3, cService3.getP3()); - Assert.assertEquals("p4", cService3.getP4()); - Assert.assertEquals("AllArguments", cService3.getConstructor()); - - Assert.assertEquals("BService", cService4.getB1Name()); - Assert.assertEquals("p2", cService4.getP2()); - Assert.assertEquals(3, cService4.getP3()); - Assert.assertEquals("p4", cService4.getP4()); - Assert.assertEquals("AllArguments", cService4.getConstructor()); - - Assert.assertEquals("BService", cService5.getB1Name()); - Assert.assertEquals("p4", cService5.getP2()); - Assert.assertEquals(3, cService5.getP3()); - Assert.assertEquals("p2", cService5.getP4()); - Assert.assertEquals("SwitchedValues", cService5.getConstructor()); - - try { - System.out.println(cService6.getB1Name()); - fail("Should have failed to call this service"); - } catch (Throwable t) { - } - - } - - /** - * Lines 1349 to 1352:
    - * 1.8.13. "@Property"
    - * ...
    - * Properties may also be injected via public setter methods even when the - * "@Property" annotation is not present. However, the "@Property" - * annotation must be used in order to inject a property onto a non-public - * field. In the case where there is no "@Property" annotation, the name of - * the property is the same as the name of the field or setter. - *

    - * p22 is unannotated protected field which should not be injected p23 is - * un-annotated protected which should not be injected via protected setter
    - */ - @Test - @Ignore("JIRA-2289 - p23 failed") - public void atProperty7() throws Exception { - Assert.assertNull(anotherAService.getP22()); - Assert.assertNull(anotherAService.getP23()); - Assert.assertFalse(anotherAService.getP23SetterIsCalled()); - } - - /** - * Lines 1349 to 1352:
    - * 1.8.13. "@Property"
    - * ...
    - * Properties may also be injected via public setter methods even when the - * "@Property" annotation is not present. However, the "@Property" - * annotation must be used in order to inject a property onto a non-public - * field. In the case where there is no "@Property" annotation, the name of - * the property is the same as the name of the field or setter. - *

    - * p24 is un-annotated protected field which should be injected via public - * setter
    - * p25 is un-annotated private field which should be injected via public - * setter
    - */ - @Test - public void atProperty8() throws Exception { - Assert.assertEquals("p24", anotherAService.getP24()); - Assert.assertTrue(anotherAService.getP24SetterIsCalled()); - Assert.assertEquals("p25", anotherAService.getP25()); - Assert.assertTrue(anotherAService.getP25SetterIsCalled()); - } - -} -- cgit v1.2.3