Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
282 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
...org/jboss/weld/tests/extensions/custombeans/types/CustomBeanWithAbstractBeanTypeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2015, Red Hat, Inc., and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* Licensed 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.jboss.weld.tests.extensions.custombeans.types; | ||
|
||
import javax.enterprise.inject.spi.Extension; | ||
import javax.inject.Inject; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.shrinkwrap.api.Archive; | ||
import org.jboss.shrinkwrap.api.BeanArchive; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
/** | ||
* Testcase for https://issues.jboss.org/browse/WELD-2010 | ||
* | ||
* @author Jozef Hartinger | ||
* @author Arjan Tijms | ||
* | ||
*/ | ||
@RunWith(Arquillian.class) | ||
public class CustomBeanWithAbstractBeanTypeTest { | ||
|
||
@Inject | ||
private MyMap map; | ||
|
||
@Deployment | ||
public static Archive<?> getDeployment() { | ||
return ShrinkWrap.create(BeanArchive.class).addPackage(CustomBeanWithAbstractBeanTypeTest.class.getPackage()) | ||
.addAsServiceProvider(Extension.class, MyMapExtension.class); | ||
} | ||
|
||
@Test | ||
public void test() { | ||
map.clear(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/custombeans/types/MyMap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2015, Red Hat, Inc., and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* Licensed 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.jboss.weld.tests.extensions.custombeans.types; | ||
|
||
import java.util.Map; | ||
|
||
public abstract class MyMap implements Map<String, Object> { | ||
} |
94 changes: 94 additions & 0 deletions
94
...arquillian/src/test/java/org/jboss/weld/tests/extensions/custombeans/types/MyMapBean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2015, Red Hat, Inc., and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* Licensed 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.jboss.weld.tests.extensions.custombeans.types; | ||
|
||
import java.lang.annotation.Annotation; | ||
import java.lang.reflect.Type; | ||
import java.util.Collections; | ||
import java.util.Set; | ||
|
||
import javax.enterprise.context.RequestScoped; | ||
import javax.enterprise.context.spi.CreationalContext; | ||
import javax.enterprise.inject.spi.Bean; | ||
import javax.enterprise.inject.spi.InjectionPoint; | ||
import javax.enterprise.inject.spi.PassivationCapable; | ||
|
||
import org.jboss.weld.literal.AnyLiteral; | ||
import org.jboss.weld.literal.DefaultLiteral; | ||
import org.jboss.weld.util.collections.Arrays2; | ||
|
||
public class MyMapBean implements Bean<MyMap>, PassivationCapable { | ||
|
||
@Override | ||
public void destroy(MyMap instance, CreationalContext<MyMap> creationalContext) { | ||
} | ||
|
||
@Override | ||
public Set<Type> getTypes() { | ||
return Collections.singleton(MyMap.class); | ||
} | ||
|
||
@Override | ||
public Set<Annotation> getQualifiers() { | ||
return Arrays2.asSet(DefaultLiteral.INSTANCE, AnyLiteral.INSTANCE); | ||
} | ||
|
||
@Override | ||
public Class<? extends Annotation> getScope() { | ||
return RequestScoped.class; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Set<Class<? extends Annotation>> getStereotypes() { | ||
return Collections.emptySet(); | ||
} | ||
|
||
@Override | ||
public boolean isAlternative() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public Class<?> getBeanClass() { | ||
return MyMap.class; | ||
} | ||
|
||
@Override | ||
public Set<InjectionPoint> getInjectionPoints() { | ||
return Collections.emptySet(); | ||
} | ||
|
||
@Override | ||
public boolean isNullable() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public MyMap create(CreationalContext<MyMap> creationalContext) { | ||
return new MyMapImpl(); | ||
} | ||
|
||
@Override | ||
public String getId() { | ||
return MyMap.class.getName(); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...llian/src/test/java/org/jboss/weld/tests/extensions/custombeans/types/MyMapExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2015, Red Hat, Inc., and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* Licensed 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.jboss.weld.tests.extensions.custombeans.types; | ||
|
||
import javax.enterprise.event.Observes; | ||
import javax.enterprise.inject.spi.AfterBeanDiscovery; | ||
import javax.enterprise.inject.spi.Extension; | ||
|
||
public class MyMapExtension implements Extension { | ||
|
||
public void registerBean(@Observes AfterBeanDiscovery event) { | ||
event.addBean(new MyMapBean()); | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
...arquillian/src/test/java/org/jboss/weld/tests/extensions/custombeans/types/MyMapImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2015, Red Hat, Inc., and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* Licensed 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.jboss.weld.tests.extensions.custombeans.types; | ||
|
||
import java.util.Collection; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import javax.enterprise.inject.Vetoed; | ||
|
||
@Vetoed | ||
public class MyMapImpl extends MyMap { | ||
|
||
@Override | ||
public Collection<Object> values() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public int size() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public Object remove(Object key) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void putAll(Map<? extends String, ? extends Object> m) { | ||
} | ||
|
||
@Override | ||
public Object put(String key, Object value) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Set<String> keySet() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean isEmpty() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public Object get(Object key) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Set<Entry<String, Object>> entrySet() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean containsValue(Object value) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean containsKey(Object key) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public void clear() { | ||
} | ||
} |