Repository: deltaspike Updated Branches: refs/heads/master b47375cac -> 52a4ad585
DELTASPIKE-593 support for mocked cdi-beans Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/52a4ad58 Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/52a4ad58 Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/52a4ad58 Branch: refs/heads/master Commit: 52a4ad585151a7d24ff1a07a8d6481e461035f32 Parents: b47375c Author: gpetracek <[email protected]> Authored: Thu May 15 17:55:11 2014 +0200 Committer: gpetracek <[email protected]> Committed: Thu May 15 18:09:45 2014 +0200 ---------------------------------------------------------------------- .../impl/mock/AbstractMockManager.java | 7 +- .../mock/uc009/MockedTypedProducedBeanTest.java | 7 +- .../mock/uc013/MockedTypedProducedBeanTest.java | 95 +++++++++++++++++ .../test/testcontrol/mock/uc013/T1.java | 24 +++++ .../test/testcontrol/mock/uc013/T2.java | 24 +++++ .../test/testcontrol/mock/uc013/T3.java | 24 +++++ .../testcontrol/mock/uc013/TypedBean1and2.java | 37 +++++++ .../test/testcontrol/mock/uc013/TypedBean3.java | 37 +++++++ .../mock/uc013/TypedBeanProducer.java | 43 ++++++++ .../mock/uc014/MockedTypedProducedBeanTest.java | 102 +++++++++++++++++++ .../test/testcontrol/mock/uc014/T1.java | 24 +++++ .../test/testcontrol/mock/uc014/T2.java | 24 +++++ .../test/testcontrol/mock/uc014/T3.java | 24 +++++ .../testcontrol/mock/uc014/TypedBean1and2.java | 37 +++++++ .../test/testcontrol/mock/uc014/TypedBean3.java | 37 +++++++ .../mock/uc014/TypedBeanProducer.java | 43 ++++++++ 16 files changed, 583 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltaspike/blob/52a4ad58/deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/AbstractMockManager.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/AbstractMockManager.java b/deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/AbstractMockManager.java index f672ea2..bd0c21f 100644 --- a/deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/AbstractMockManager.java +++ b/deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/AbstractMockManager.java @@ -61,7 +61,12 @@ public abstract class AbstractMockManager implements DynamicMockManager } else { - Typed typed = beanClass.getAnnotation(Typed.class); + Typed typed = mockClass.getAnnotation(Typed.class); + + if (typed == null || typed.value().length == 0) + { + typed = beanClass.getAnnotation(Typed.class); + } if (typed != null && typed.value().length > 0) { http://git-wip-us.apache.org/repos/asf/deltaspike/blob/52a4ad58/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc009/MockedTypedProducedBeanTest.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc009/MockedTypedProducedBeanTest.java b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc009/MockedTypedProducedBeanTest.java index 7e066c3..89911b5 100644 --- a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc009/MockedTypedProducedBeanTest.java +++ b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc009/MockedTypedProducedBeanTest.java @@ -21,7 +21,6 @@ package org.apache.deltaspike.test.testcontrol.mock.uc009; import org.apache.deltaspike.test.category.SeCategory; import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner; import org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager; -import org.apache.deltaspike.testcontrol.api.mock.TypedMock; import org.junit.Assert; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -58,8 +57,7 @@ public class MockedTypedProducedBeanTest Assert.assertEquals(14, t3.getCount()); } - @Typed() //exclude it for the cdi type-check - @TypedMock({T1.class, T2.class}) //specify the types for mocking (to replace the producer) + @Typed({T1.class, T2.class}) //fine for the cdi-container due to parametrized constructor private static class MockedTypedBean1and2 extends TypedBean1and2 { private final int mockedCount; @@ -76,8 +74,7 @@ public class MockedTypedProducedBeanTest } } - @Typed() //exclude it for the cdi type-check - @TypedMock(T3.class) + @Typed(T3.class) //fine for the cdi-container due to parametrized constructor private static class MockedTypedBean3 extends TypedBean3 { private final int mockedCount; http://git-wip-us.apache.org/repos/asf/deltaspike/blob/52a4ad58/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/MockedTypedProducedBeanTest.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/MockedTypedProducedBeanTest.java b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/MockedTypedProducedBeanTest.java new file mode 100644 index 0000000..23f328e --- /dev/null +++ b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/MockedTypedProducedBeanTest.java @@ -0,0 +1,95 @@ +/* + * 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.deltaspike.test.testcontrol.mock.uc013; + +import org.apache.deltaspike.test.category.SeCategory; +import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner; +import org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager; +import org.apache.deltaspike.testcontrol.api.mock.TypedMock; +import org.junit.Assert; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; + +import javax.enterprise.inject.Typed; +import javax.inject.Inject; + +//Usually NOT needed! Currently only needed due to our arquillian-setup +@Category(SeCategory.class) + +@RunWith(CdiTestRunner.class) +public class MockedTypedProducedBeanTest +{ + @Inject + private T1 t1; + + @Inject + private T2 t2; + + @Inject + private T3 t3; + + @Inject + private DynamicMockManager mockManager; + + @Test + public void manualMockT1() + { + mockManager.addMock(new MockedTypedBean1and2(7)); + mockManager.addMock(new MockedTypedBean3(14)); + Assert.assertEquals(7, t1.getCount()); + Assert.assertEquals(7, t2.getCount()); + Assert.assertEquals(14, t3.getCount()); + } + + @TypedMock({T1.class, T2.class}) //specify the types for mocking (to replace the producer) + private static class MockedTypedBean1and2 extends TypedBean1and2 + { + private final int mockedCount; + + private MockedTypedBean1and2(int mockedCount) //-> no @Typed() needed + { + this.mockedCount = mockedCount; + } + + @Override + public int getCount() + { + return mockedCount; + } + } + + //exclude it for the cdi type-check + @TypedMock(T3.class) + private static class MockedTypedBean3 extends TypedBean3 + { + private final int mockedCount; + + private MockedTypedBean3(int mockedCount) //-> no @Typed() needed + { + this.mockedCount = mockedCount; + } + + @Override + public int getCount() + { + return mockedCount; + } + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/52a4ad58/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/T1.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/T1.java b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/T1.java new file mode 100644 index 0000000..5355dbd --- /dev/null +++ b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/T1.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.test.testcontrol.mock.uc013; + +public interface T1 +{ + int getCount(); +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/52a4ad58/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/T2.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/T2.java b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/T2.java new file mode 100644 index 0000000..b370acd --- /dev/null +++ b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/T2.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.test.testcontrol.mock.uc013; + +public interface T2 +{ + int getCount(); +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/52a4ad58/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/T3.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/T3.java b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/T3.java new file mode 100644 index 0000000..1cdb412 --- /dev/null +++ b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/T3.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.test.testcontrol.mock.uc013; + +public interface T3 +{ + int getCount(); +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/52a4ad58/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/TypedBean1and2.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/TypedBean1and2.java b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/TypedBean1and2.java new file mode 100644 index 0000000..bcb84bf --- /dev/null +++ b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/TypedBean1and2.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.test.testcontrol.mock.uc013; + +import javax.enterprise.inject.Typed; + +@Typed() //exclude it for the cdi type-check +public class TypedBean1and2 implements T1, T2, T3 +{ + private int count = 0; + + public int getCount() + { + return count; + } + + public void increaseCount() + { + this.count++; + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/52a4ad58/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/TypedBean3.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/TypedBean3.java b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/TypedBean3.java new file mode 100644 index 0000000..d9a353c --- /dev/null +++ b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/TypedBean3.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.test.testcontrol.mock.uc013; + +import javax.enterprise.inject.Typed; + +@Typed() //exclude it for the cdi type-check +public class TypedBean3 implements T1, T2, T3 +{ + private int count = 0; + + public int getCount() + { + return count; + } + + public void increaseCount() + { + this.count++; + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/52a4ad58/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/TypedBeanProducer.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/TypedBeanProducer.java b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/TypedBeanProducer.java new file mode 100644 index 0000000..f1be745 --- /dev/null +++ b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/TypedBeanProducer.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.test.testcontrol.mock.uc013; + +import javax.enterprise.context.RequestScoped; +import javax.enterprise.inject.Produces; +import javax.enterprise.inject.Typed; + +@Typed() //exclude it for the cdi type-check +public class TypedBeanProducer +{ + @Produces + @RequestScoped + @Typed({T1.class, T2.class}) + public TypedBean1and2 produce1and2() + { + return new TypedBean1and2(); + } + + @Produces + @RequestScoped + @Typed(T3.class) + public TypedBean3 produce3() + { + return new TypedBean3(); + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/52a4ad58/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/MockedTypedProducedBeanTest.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/MockedTypedProducedBeanTest.java b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/MockedTypedProducedBeanTest.java new file mode 100644 index 0000000..9be7d30 --- /dev/null +++ b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/MockedTypedProducedBeanTest.java @@ -0,0 +1,102 @@ +/* + * 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.deltaspike.test.testcontrol.mock.uc014; + +import org.apache.deltaspike.test.category.SeCategory; +import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner; +import org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager; +import org.apache.deltaspike.testcontrol.api.mock.TypedMock; +import org.junit.Assert; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; + +import javax.enterprise.inject.Typed; +import javax.inject.Inject; + +//Usually NOT needed! Currently only needed due to our arquillian-setup +@Category(SeCategory.class) + +@RunWith(CdiTestRunner.class) +public class MockedTypedProducedBeanTest +{ + @Inject + private T1 t1; + + @Inject + private T2 t2; + + @Inject + private T3 t3; + + @Inject + private DynamicMockManager mockManager; + + @Test + public void manualMockT1() + { + MockedTypedBean1and2 mockedTypedBean1and2 = new MockedTypedBean1and2(); + mockedTypedBean1and2.setMockedCount(7); + mockManager.addMock(mockedTypedBean1and2); + + MockedTypedBean3 mockedTypedBean3 = new MockedTypedBean3(); + mockedTypedBean3.setMockedCount(14); + mockManager.addMock(mockedTypedBean3); + + Assert.assertEquals(7, t1.getCount()); + Assert.assertEquals(7, t2.getCount()); + Assert.assertEquals(14, t3.getCount()); + } + + @Typed() //exclude it for the cdi type-check + @TypedMock({T1.class, T2.class}) //specify the types for mocking (to replace the producer) + private static class MockedTypedBean1and2 extends TypedBean1and2 + { + private int mockedCount; + + private void setMockedCount(int mockedCount) + { + this.mockedCount = mockedCount; + } + + @Override + public int getCount() + { + return mockedCount; + } + } + + @Typed() //exclude it for the cdi type-check + @TypedMock(T3.class) + private static class MockedTypedBean3 extends TypedBean3 + { + private int mockedCount; + + private void setMockedCount(int mockedCount) + { + this.mockedCount = mockedCount; + } + + @Override + public int getCount() + { + return mockedCount; + } + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/52a4ad58/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/T1.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/T1.java b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/T1.java new file mode 100644 index 0000000..59e7911 --- /dev/null +++ b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/T1.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.test.testcontrol.mock.uc014; + +public interface T1 +{ + int getCount(); +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/52a4ad58/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/T2.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/T2.java b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/T2.java new file mode 100644 index 0000000..efbf374 --- /dev/null +++ b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/T2.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.test.testcontrol.mock.uc014; + +public interface T2 +{ + int getCount(); +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/52a4ad58/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/T3.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/T3.java b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/T3.java new file mode 100644 index 0000000..818c008 --- /dev/null +++ b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/T3.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.test.testcontrol.mock.uc014; + +public interface T3 +{ + int getCount(); +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/52a4ad58/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/TypedBean1and2.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/TypedBean1and2.java b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/TypedBean1and2.java new file mode 100644 index 0000000..c2a7a29 --- /dev/null +++ b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/TypedBean1and2.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.test.testcontrol.mock.uc014; + +import javax.enterprise.inject.Typed; + +@Typed() //exclude it for the cdi type-check +public class TypedBean1and2 implements T1, T2, T3 +{ + private int count = 0; + + public int getCount() + { + return count; + } + + public void increaseCount() + { + this.count++; + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/52a4ad58/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/TypedBean3.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/TypedBean3.java b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/TypedBean3.java new file mode 100644 index 0000000..6ce3ac7 --- /dev/null +++ b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/TypedBean3.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.test.testcontrol.mock.uc014; + +import javax.enterprise.inject.Typed; + +@Typed() //exclude it for the cdi type-check +public class TypedBean3 implements T1, T2, T3 +{ + private int count = 0; + + public int getCount() + { + return count; + } + + public void increaseCount() + { + this.count++; + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/52a4ad58/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/TypedBeanProducer.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/TypedBeanProducer.java b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/TypedBeanProducer.java new file mode 100644 index 0000000..44bba9f --- /dev/null +++ b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/TypedBeanProducer.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.test.testcontrol.mock.uc014; + +import javax.enterprise.context.RequestScoped; +import javax.enterprise.inject.Produces; +import javax.enterprise.inject.Typed; + +@Typed() //exclude it for the cdi type-check +public class TypedBeanProducer +{ + @Produces + @RequestScoped + @Typed({T1.class, T2.class}) + public TypedBean1and2 produce1and2() + { + return new TypedBean1and2(); + } + + @Produces + @RequestScoped + @Typed(T3.class) + public TypedBean3 produce3() + { + return new TypedBean3(); + } +}
