-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24989 from arjantijms/8_0_cdi_4_1_0_tck
8 0 cdi 4 1 0 tck
- Loading branch information
Showing
7 changed files
with
181 additions
and
28 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
69 changes: 69 additions & 0 deletions
69
...tck/cdi/cdi-full/src/test/java/org/jboss/weld/tck/glassfish/GlassFishContextualsImpl.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,69 @@ | ||
/* | ||
* Copyright (c) 2024 Eclipse Foundation and/or its affiliates. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0, which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the | ||
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
* version 2 with the GNU Classpath Exception, which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
*/ | ||
package org.jboss.weld.tck.glassfish; | ||
|
||
import jakarta.enterprise.context.spi.Context; | ||
import jakarta.enterprise.context.spi.CreationalContext; | ||
import org.jboss.cdi.tck.spi.Contextuals; | ||
|
||
public class GlassFishContextualsImpl implements Contextuals { | ||
|
||
@Override | ||
public <T> Inspectable<T> create(T instance, Context context) { | ||
return new InspectableContextual<>(instance); | ||
} | ||
|
||
static class InspectableContextual<T> implements Inspectable<T> { | ||
|
||
private T instancePassedToConstructor; | ||
private T instancePassedToDestroy; | ||
|
||
private CreationalContext<T> creationalContextPassedToCreate; | ||
private CreationalContext<T> creationalContextPassedToDestroy; | ||
|
||
InspectableContextual(T instance) { | ||
this.instancePassedToConstructor = instance; | ||
} | ||
|
||
@Override | ||
public T create(CreationalContext<T> creationalContext) { | ||
this.creationalContextPassedToCreate = creationalContext; | ||
return instancePassedToConstructor; | ||
} | ||
|
||
@Override | ||
public void destroy(T instance, CreationalContext<T> creationalContext) { | ||
instancePassedToDestroy = instance; | ||
creationalContextPassedToDestroy = creationalContext; | ||
} | ||
|
||
@Override | ||
public CreationalContext<T> getCreationalContextPassedToCreate() { | ||
return creationalContextPassedToCreate; | ||
} | ||
|
||
@Override | ||
public T getInstancePassedToDestroy() { | ||
return instancePassedToDestroy; | ||
} | ||
|
||
@Override | ||
public CreationalContext<T> getCreationalContextPassedToDestroy() { | ||
return creationalContextPassedToDestroy; | ||
} | ||
} | ||
|
||
} |
80 changes: 80 additions & 0 deletions
80
.../cdi-full/src/test/java/org/jboss/weld/tck/glassfish/GlassFishCreationalContextsImpl.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,80 @@ | ||
/* | ||
* Copyright (c) 2024 Contributors to the Eclipse Foundation. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0, which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the | ||
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
* version 2 with the GNU Classpath Exception, which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
*/ | ||
package org.jboss.weld.tck.glassfish; | ||
|
||
import jakarta.enterprise.context.spi.Contextual; | ||
import org.jboss.cdi.tck.spi.CreationalContexts; | ||
import org.jboss.weld.contexts.CreationalContextImpl; | ||
|
||
/** | ||
* This returns the Weld (and thus GlassFish) specific CreationalContextImpl with added methods | ||
* for inspection. | ||
*/ | ||
public class GlassFishCreationalContextsImpl implements CreationalContexts { | ||
|
||
@Override | ||
public <T> Inspectable<T> create(Contextual<T> contextual) { | ||
return new InspectableCreationalContext<>(contextual); | ||
} | ||
|
||
static class InspectableCreationalContext<T> extends CreationalContextImpl<T> implements Inspectable<T> { | ||
|
||
private T lastBeanPushed; | ||
private boolean pushCalled; | ||
private boolean releaseCalled; | ||
|
||
public InspectableCreationalContext(Contextual<T> contextual) { | ||
super(contextual); | ||
} | ||
|
||
@Override | ||
public void push(T incompleteInstance) { | ||
lastBeanPushed = incompleteInstance; | ||
|
||
pushCalled = true; | ||
super.push(incompleteInstance); | ||
} | ||
|
||
@Override | ||
public Object getLastBeanPushed() { | ||
return lastBeanPushed; | ||
} | ||
|
||
@Override | ||
public boolean isPushCalled() { | ||
return pushCalled; | ||
} | ||
|
||
@Override | ||
public boolean isReleaseCalled() { | ||
return releaseCalled; | ||
} | ||
|
||
@Override | ||
public void release(Contextual<T> contextual, T instance) { | ||
releaseCalled = true; | ||
super.release(contextual, instance); | ||
} | ||
|
||
@Override | ||
public void release() { | ||
releaseCalled = true; | ||
super.release(); | ||
} | ||
|
||
} | ||
|
||
} |
2 changes: 2 additions & 0 deletions
2
appserver/tests/tck/cdi/cdi-full/src/test/resources/META-INF/cdi-tck.properties
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