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
6 changed files
with
162 additions
and
4 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...quillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/AlarmedChickenHutch.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,34 @@ | ||
package org.jboss.weld.tests.enterprise.lifecycle; | ||
|
||
import java.io.Serializable; | ||
|
||
import javax.decorator.Decorator; | ||
import javax.decorator.Delegate; | ||
import javax.inject.Inject; | ||
|
||
@Decorator | ||
public abstract class AlarmedChickenHutch implements ChickenHutch, Serializable | ||
{ | ||
|
||
private static boolean ping; | ||
|
||
public static void reset() | ||
{ | ||
ping = false; | ||
} | ||
|
||
public static boolean isPing() | ||
{ | ||
return ping; | ||
} | ||
|
||
@Inject @Delegate | ||
private ChickenHutch chickenHutch; | ||
|
||
public void ping() | ||
{ | ||
ping = true; | ||
chickenHutch.ping(); | ||
} | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/ChickenHutch.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,11 @@ | ||
package org.jboss.weld.tests.enterprise.lifecycle; | ||
|
||
import javax.ejb.Local; | ||
|
||
@Local | ||
public interface ChickenHutch | ||
{ | ||
|
||
public void ping(); | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
...quillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/ChickenHutchFactory.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,16 @@ | ||
package org.jboss.weld.tests.enterprise.lifecycle; | ||
|
||
import javax.enterprise.inject.Produces; | ||
|
||
public class ChickenHutchFactory | ||
{ | ||
|
||
// Redirect via a producer method so dependents are automatically destroyed | ||
@Produces @MassProduced | ||
public ChickenHutch makeChickenHutch(ChickenHutch chickenHutch) | ||
{ | ||
chickenHutch.ping(); | ||
return chickenHutch; | ||
} | ||
|
||
} |
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
36 changes: 36 additions & 0 deletions
36
tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/MassProduced.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,36 @@ | ||
/* | ||
* 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.enterprise.lifecycle; | ||
|
||
import static java.lang.annotation.ElementType.FIELD; | ||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.ElementType.PARAMETER; | ||
import static java.lang.annotation.ElementType.TYPE; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import javax.inject.Qualifier; | ||
|
||
@Retention(RUNTIME) | ||
@Target({TYPE, METHOD, FIELD, PARAMETER}) | ||
@Qualifier | ||
@interface MassProduced | ||
{ | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
...uillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/StandardChickenHutch.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,47 @@ | ||
package org.jboss.weld.tests.enterprise.lifecycle; | ||
|
||
import javax.annotation.PreDestroy; | ||
import javax.ejb.Stateful; | ||
|
||
@Stateful | ||
public class StandardChickenHutch implements ChickenHutch | ||
{ | ||
|
||
private static boolean preDestroy; | ||
|
||
private static boolean ping; | ||
|
||
public static boolean isPing() | ||
{ | ||
return ping; | ||
} | ||
|
||
public static void reset() | ||
{ | ||
preDestroy = false; | ||
ping = false; | ||
} | ||
|
||
public static boolean isPredestroy() | ||
{ | ||
return preDestroy; | ||
} | ||
|
||
public void ping() | ||
{ | ||
ping = true; | ||
} | ||
|
||
@PreDestroy | ||
public void preDestroy() | ||
{ | ||
if (ping) | ||
{ | ||
preDestroy = true; | ||
} | ||
else | ||
{ | ||
preDestroy = false; | ||
} | ||
} | ||
} |