Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Weld API to 4.0.CR1. #2209

Merged
merged 2 commits into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</developers>

<properties>
<weld.api.bom.version>4.0.Beta1</weld.api.bom.version>
<weld.api.bom.version>4.0.CR1</weld.api.bom.version>
<gpg.plugin.version>1.6</gpg.plugin.version>
<jboss.releases.repo.url>https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/</jboss.releases.repo.url>
<jboss.snapshots.repo.url>https://repository.jboss.org/nexus/content/repositories/snapshots/</jboss.snapshots.repo.url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@

package org.jboss.weld.environment.se.test.provider.custom;

import jakarta.enterprise.inject.Instance;
import jakarta.enterprise.inject.Vetoed;
import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.enterprise.inject.spi.CDI;
import jakarta.enterprise.inject.spi.CDIProvider;
import jakarta.enterprise.util.TypeLiteral;

import java.lang.annotation.Annotation;
import java.util.Iterator;

/**
* @author Martin Kouba
Expand All @@ -33,11 +39,59 @@ public class CustomCDIProvider implements CDIProvider {
@Override
public CDI<Object> getCDI() {
isCalled = true;
return null;
// we cannot return just null, CDI checks that
return new CustomCdi();
}

public static void reset() {
isCalled = false;
}

public class CustomCdi extends CDI<Object> {

@Override
public BeanManager getBeanManager() {
return null;
}

@Override
public Instance<Object> select(Annotation... qualifiers) {
return null;
}

@Override
public <U> Instance<U> select(Class<U> subtype, Annotation... qualifiers) {
return null;
}

@Override
public <U> Instance<U> select(TypeLiteral<U> subtype, Annotation... qualifiers) {
return null;
}

@Override
public boolean isUnsatisfied() {
return false;
}

@Override
public boolean isAmbiguous() {
return false;
}

@Override
public void destroy(Object instance) {

}

@Override
public Object get() {
return null;
}

@Override
public Iterator<Object> iterator() {
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
package org.jboss.weld.environment.se.test.provider.custom;

import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import jakarta.enterprise.inject.spi.CDI;
Expand All @@ -34,7 +34,9 @@ public void testCustomCDIProvider() {
try {
CustomCDIProvider.reset();
CDI.setCDIProvider(new CustomCDIProvider());
assertNull(CDI.current());
CDI<Object> current = CDI.current();
assertNotNull(current);
assertTrue(current instanceof CustomCDIProvider.CustomCdi);
assertTrue(CustomCDIProvider.isCalled);
} finally {
// Unset the CDIProvider so that other tests are not affected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@

package org.jboss.weld.environment.servlet.test.provider;

import jakarta.enterprise.inject.Instance;
import jakarta.enterprise.inject.Vetoed;
import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.enterprise.inject.spi.CDI;
import jakarta.enterprise.inject.spi.CDIProvider;
import jakarta.enterprise.util.TypeLiteral;

import java.lang.annotation.Annotation;
import java.util.Iterator;

/**
* @author Martin Kouba
Expand All @@ -33,11 +39,59 @@ public class CustomCDIProvider implements CDIProvider {
@Override
public CDI<Object> getCDI() {
isCalled = true;
return null;
return new CustomCdi();
}

public static void reset() {
isCalled = false;
}

public class CustomCdi extends CDI<Object> {

@Override
public BeanManager getBeanManager() {
return null;
}

@Override
public Instance<Object> select(Annotation... qualifiers) {
return null;
}

@Override
public <U> Instance<U> select(Class<U> subtype, Annotation... qualifiers) {
return null;
}

@Override
public <U> Instance<U> select(TypeLiteral<U> subtype, Annotation... qualifiers) {
return null;
}

@Override
public boolean isUnsatisfied() {
return false;
}

@Override
public boolean isAmbiguous() {
return false;
}

@Override
public void destroy(Object instance) {

}

@Override
public Object get() {
return null;
}

@Override
public Iterator<Object> iterator() {
return null;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package org.jboss.weld.environment.servlet.test.provider;

import static org.jboss.weld.environment.servlet.test.util.Deployments.baseDeployment;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import jakarta.enterprise.inject.spi.CDI;
Expand All @@ -41,7 +41,9 @@ public void testCustomCDIProvider() {
try {
CustomCDIProvider.reset();
CDI.setCDIProvider(new CustomCDIProvider());
assertNull(CDI.current());
CDI<Object> current = CDI.current();
assertNotNull(current);
assertTrue(current instanceof CustomCDIProvider.CustomCdi);
assertTrue(CustomCDIProvider.isCalled);
} finally {
// Unset the CDIProvider so that other tests are not affected
Expand Down
6 changes: 6 additions & 0 deletions jboss-tck-runner/src/test/tck20/tck-tests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
<!-- Issues in the spec -->

<!-- Issues in the TCK -->
<!-- https://github.com/eclipse-ee4j/cdi-tck/issues/217 -->
<class name="org.jboss.cdi.tck.tests.se.customCDIProvider.CustomCDIProviderTest">
<methods>
<exclude name=".*"/>
</methods>
</class>

<!-- Issues in Weld (the RI) -->

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<shrinkwrap.resolver.version>3.1.4</shrinkwrap.resolver.version>
<testng.version>6.14.3</testng.version>
<testng.jcommander.version>1.78</testng.jcommander.version>
<weld.api.version>4.0.Beta1</weld.api.version>
<weld.api.version>4.0.CR1</weld.api.version>
<weld.logging.tools.version>1.0.3.Final</weld.logging.tools.version>
<wildfly.arquillian.version>3.0.1.Final</wildfly.arquillian.version>
</properties>
Expand Down