Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WELD-2165 Detect non-unique BeanDeploymentArchive/BeanManager identifier
- also upgrade TestNG to 6.8.8
- Loading branch information
Showing
9 changed files
with
170 additions
and
10 deletions.
There are no files selected for viewing
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
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
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
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
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
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
28 changes: 28 additions & 0 deletions
28
tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/duplicit/Bar.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 2010, 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.unit.deployment.structure.duplicit; | ||
|
||
import javax.enterprise.inject.Produces; | ||
|
||
public class Bar { | ||
|
||
@Produces | ||
public String get() { | ||
return "Foo!"; | ||
} | ||
|
||
} |
74 changes: 74 additions & 0 deletions
74
...a/org/jboss/weld/tests/unit/deployment/structure/duplicit/DuplicateBeanArchiveIdTest.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,74 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 201, 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.unit.deployment.structure.duplicit; | ||
|
||
import org.jboss.arquillian.container.weld.ee.embedded_1_1.mock.BeanDeploymentArchiveImpl; | ||
import org.jboss.arquillian.container.weld.ee.embedded_1_1.mock.TestContainer; | ||
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive; | ||
import org.jboss.weld.bootstrap.spi.Deployment; | ||
import org.jboss.weld.exceptions.DeploymentException; | ||
import org.jboss.weld.mock.AbstractDeployment; | ||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* https://issues.jboss.org/browse/WELD-2165 | ||
* | ||
* @author Martin Kouba | ||
*/ | ||
public class DuplicateBeanArchiveIdTest { | ||
|
||
@Test(expectedExceptions = { DeploymentException.class }) | ||
public void test() { | ||
// Override equals/hashcode - bda is used in a map | ||
final BeanDeploymentArchive bda1 = new BeanDeploymentArchiveImpl("1", Foo.class) { | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
return (this == obj); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return System.identityHashCode(this); | ||
} | ||
}; | ||
final BeanDeploymentArchive bda2 = new BeanDeploymentArchiveImpl("1", Bar.class) { | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
return (this == obj); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return System.identityHashCode(this); | ||
} | ||
}; | ||
|
||
Deployment deployment = new AbstractDeployment(bda1, bda2) { | ||
|
||
@Override | ||
public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass) { | ||
return loadBeanDeploymentArchive(beanClass); | ||
} | ||
}; | ||
|
||
TestContainer container = new TestContainer(deployment); | ||
container.startContainer(); | ||
container.stopContainer(); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/duplicit/Foo.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 2010, 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.unit.deployment.structure.duplicit; | ||
|
||
import javax.enterprise.inject.Produces; | ||
|
||
public class Foo { | ||
|
||
@Produces | ||
public String get() { | ||
return "Foo!"; | ||
} | ||
|
||
} |