Package org.springframework.context

Examples of org.springframework.context.ApplicationEventPublisher


        HttpSession session = request.getSession();
        session.setAttribute("blah", "blah");
        session.setAttribute("SPRING_SECURITY_SAVED_REQUEST_KEY", "DefaultSavedRequest");
        String oldSessionId = session.getId();

        ApplicationEventPublisher eventPublisher = mock(ApplicationEventPublisher.class);
        strategy.setApplicationEventPublisher(eventPublisher);

        Authentication mockAuthentication = mock(Authentication.class);

        strategy.onAuthentication(mockAuthentication, request, new MockHttpServletResponse());
View Full Code Here


        HttpSession session = request.getSession();
        session.setAttribute("blah", "blah");
        session.setAttribute("SPRING_SECURITY_SAVED_REQUEST_KEY", "DefaultSavedRequest");
        String oldSessionId = session.getId();

        ApplicationEventPublisher eventPublisher = mock(ApplicationEventPublisher.class);
        strategy.setApplicationEventPublisher(eventPublisher);

        Authentication mockAuthentication = mock(Authentication.class);

        strategy.onAuthentication(mockAuthentication, request, new MockHttpServletResponse());
View Full Code Here

    // SEC-2002
    @Test
    public void onAuthenticationChangeSessionWithEventPublisher() {
        String originalSessionId = request.getSession().getId();

        ApplicationEventPublisher eventPublisher = mock(ApplicationEventPublisher.class);
        strategy.setApplicationEventPublisher(eventPublisher);

        strategy.onAuthentication(authentication, request, response);

        verify(sessionRegistry,times(0)).removeSessionInformation(anyString());
View Full Code Here

    DefaultAuthenticationEventPublisher publisher;

    @Test
    public void expectedDefaultMappingsAreSatisfied() throws Exception {
        publisher = new DefaultAuthenticationEventPublisher();
        ApplicationEventPublisher appPublisher = mock(ApplicationEventPublisher.class);
        publisher.setApplicationEventPublisher(appPublisher);
        Authentication a = mock(Authentication.class);

        Exception cause = new Exception();
        Object extraInfo = new Object();
View Full Code Here

    }

    @Test
    public void authenticationSuccessIsPublished() {
        publisher = new DefaultAuthenticationEventPublisher();
        ApplicationEventPublisher appPublisher = mock(ApplicationEventPublisher.class);
        publisher.setApplicationEventPublisher(appPublisher);
        publisher.publishAuthenticationSuccess(mock(Authentication.class));
        verify(appPublisher).publishEvent(isA(AuthenticationSuccessEvent.class));

        publisher.setApplicationEventPublisher(null);
View Full Code Here

    public void additionalExceptionMappingsAreSupported() {
        publisher = new DefaultAuthenticationEventPublisher();
        Properties p = new Properties();
        p.put(MockAuthenticationException.class.getName(), AuthenticationFailureDisabledEvent.class.getName());
        publisher.setAdditionalExceptionMappings(p);
        ApplicationEventPublisher appPublisher = mock(ApplicationEventPublisher.class);

        publisher.setApplicationEventPublisher(appPublisher);
        publisher.publishAuthenticationFailure(new MockAuthenticationException("test"), mock(Authentication.class));
        verify(appPublisher).publishEvent(isA(AuthenticationFailureDisabledEvent.class));
    }
View Full Code Here

    public void unknownFailureExceptionIsIgnored() throws Exception {
        publisher = new DefaultAuthenticationEventPublisher();
        Properties p = new Properties();
        p.put(MockAuthenticationException.class.getName(), AuthenticationFailureDisabledEvent.class.getName());
        publisher.setAdditionalExceptionMappings(p);
        ApplicationEventPublisher appPublisher = mock(ApplicationEventPublisher.class);

        publisher.setApplicationEventPublisher(appPublisher);
        publisher.publishAuthenticationFailure(new AuthenticationException("") {}, mock(Authentication.class));
        verifyZeroInteractions(appPublisher);
    }
View Full Code Here

       
        //Create the rendering lock for the user
        this.renderingLock = new Object();
       
        // Record the creation of the session
        final ApplicationEventPublisher applicationEventPublisher = EventPublisherLocator.getApplicationEventPublisher();
        applicationEventPublisher.publishEvent(new UserSessionCreatedPortalEvent(this, this.person));

        userSessions.incrementAndGet();
    }
View Full Code Here

        }
       
        GroupService.finishedSession(this.person);
       
        // Record the destruction of the session
        final ApplicationEventPublisher applicationEventPublisher = EventPublisherLocator.getApplicationEventPublisher();
        applicationEventPublisher.publishEvent(new UserSessionDestroyedPortalEvent(this, this.person));
       
        userSessions.decrementAndGet();
    }
View Full Code Here

                    throw new IllegalStateException("ChannelFactory returned null on request to instantiate layout channel with id [" + sessionId + "] and description [" + channelDescription + "]");
                }

                final IPerson person = userPreferencesManager.getPerson();
               
                final ApplicationEventPublisher applicationEventPublisher = EventPublisherLocator.getApplicationEventPublisher();
                final UserProfile currentProfile = userPreferencesManager.getCurrentProfile();
               
                IUserLayoutNodeDescription parentNode = null;
                try {
                    final IUserLayoutManager userLayoutManager = userPreferencesManager.getUserLayoutManager();
                   
                    final String parentNodeId = userLayoutManager.getParentId(channelDescription.getId());
                    if (parentNodeId != null) {
                        parentNode = userLayoutManager.getNode(parentNodeId);
                    }
                }
                catch (PortalException pe) {
                    log.warn("Failed to load parent IUserLayoutNodeDescription for channel with subscribe id: " + channelDescription.getChannelPublishId(), pe);
                }
                applicationEventPublisher.publishEvent(new ChannelInstanciatedInLayoutPortalEvent(this, person, currentProfile, channelDescription, parentNode));

                // Create and stuff the channel static data
                final ChannelStaticData channelStaticData = new ChannelStaticData(channelDescription.getParameterMap(), userPreferencesManager.getUserLayoutManager());
                channelStaticData.setChannelSubscribeId(channelSubscribeId);
                channelStaticData.setTimeout(channelDescription.getTimeout());
View Full Code Here

TOP

Related Classes of org.springframework.context.ApplicationEventPublisher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.