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
@RunWith(CdiTestRunner.class) | |
public class InjectionTest | |
{ | |
@Inject | |
private MyCdiBean bean1; | |
@EJB //or @Inject | |
private MyEjb bean2; | |
@Test |
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
public class MonitoredMethodInvocationProcessor | |
{ | |
//... | |
public void onMonitoredMethodInvocations(@Observes MonitoredMethodInvocationsEvent methodInvocationsEvent) | |
{ | |
String userId = this.userHolder.getCurrentUserId(); | |
for (MethodInvocationDescriptor methodInvocation : methodInvocationsEvent.getMethodInvocationDescriptors()) | |
{ |
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
@RunWith(CdiTestRunner.class) | |
public class ManuallyMockedCdiBeanTest | |
{ | |
@Inject | |
private MyCdiBean myCdiBean; | |
@Inject | |
private DynamicMockContext mockContext; | |
@Test |
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
@RequestScoped | |
public class MyCdiBean | |
{ | |
private int count = 0; | |
public int getCount() | |
{ | |
return count; | |
} |
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
@RunWith(CdiTestRunner.class) | |
public class MockitoMockedCdiBeanTest | |
{ | |
@Inject | |
private MyCdiBean myCdiBean; | |
@Inject | |
private DynamicMockContext mockContext; | |
@Test |
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
@ApplicationScoped | |
public class AsyncObserver | |
{ | |
public void onEvent(@ObservesAsynchronous MyEvent event) | |
{ | |
//... | |
} | |
} |
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
public class DefaultEventBroadcastingTest | |
{ | |
@Inject | |
private AsynchronousEvent<MyEvent> myAsyncEvent; | |
public void fireAsyncEvent() | |
{ | |
this.myAsyncEvent.fire(new MyEvent(/*...*/)); | |
} | |
} |
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
@SessionScoped | |
@JsfPhaseListener | |
public class WindowQuotaHandler implements PhaseListener | |
{ | |
@Inject | |
private WindowContext windowContext; | |
private Stack<String> windowIdStack = new Stack<String>(); | |
@Override |
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
class ViewConversationExpirationEvaluator | |
implements ConversationExpirationEvaluator | |
{ | |
private static final long serialVersionUID = -1298186767354202960L; | |
private String viewId; | |
private boolean expired; | |
ViewConversationExpirationEvaluator() | |
{ | |
if(FacesContext.getCurrentInstance().getViewRoot() != null) |
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
import org.os890.codi.addon.conversation.api.ViewConversationScoped; | |
import javax.annotation.PostConstruct; | |
import javax.inject.Named; | |
import java.io.Serializable; | |
import java.util.Date; | |
@Named | |
@ViewConversationScoped | |
public class ViewConversationBean implements Serializable |
OlderNewer