test_class.declarator: notifier
test_class.modifier: private
test_class.original_string: private HttpSessionNotifier notifier;
test_class.type: HttpSessionNotifier
test_class.var_name: notifier
test_class.declarator: session
test_class.modifier: private
test_class.original_string: private RepositoryBackedSession session;
test_class.type: RepositoryBackedSession
test_class.var_name: session
test_class.declarator: descriptor
test_class.modifier: private
test_class.original_string: private ServletContextDescriptor descriptor;
test_class.type: ServletContextDescriptor
test_class.var_name: descriptor
test_class.file: session-replacement/src/test/java/com/amadeus/session/servlet/TestHttpSessionNotifier.java
test_class.identifier: TestHttpSessionNotifier
test_case.body: @Test
    public void testSessionDestroyed() {
      HttpSessionBindingListener bindingListener = mock(HttpSessionBindingListener.class);
      String dummy = "dummy";
      when(session.getAttribute("binding")).thenReturn(bindingListener);
      when(session.getAttribute("attribute")).thenReturn(dummy);
      when(session.getAttributeNamesWithValues()).thenReturn(Arrays.asList("binding", "attribute"));
      HttpSessionListener listener = mock(HttpSessionListener.class);
      descriptor.addHttpSessionListener(listener);
      notifier.sessionDestroyed(session, false);
      verify(bindingListener).valueUnbound(any(HttpSessionBindingEvent.class));
      verify(listener).sessionDestroyed(any(HttpSessionEvent.class));
      HttpSessionListener listener2 = mock(HttpSessionListener.class);
      HttpSessionBindingListener bindingListener2 = mock(HttpSessionBindingListener.class);
      when(session.getAttribute("binding2")).thenReturn(bindingListener2);
      when(session.getAttributeNamesWithValues()).thenReturn(Arrays.asList("binding", "attribute", "binding2"));
      descriptor.addHttpSessionListener(listener2);
      notifier.sessionDestroyed(session, false);
      verify(listener, times(2)).sessionDestroyed(any(HttpSessionEvent.class));
      verify(bindingListener, times(2)).valueUnbound(any(HttpSessionBindingEvent.class));
      verify(bindingListener2).valueUnbound(any(HttpSessionBindingEvent.class));
      verify(listener2).sessionDestroyed(any(HttpSessionEvent.class));
    }
test_case.class_method_signature: TestHttpSessionNotifier.testSessionDestroyed()
test_case.full_signature: @Test public void testSessionDestroyed()
test_case.identifier: testSessionDestroyed
test_case.invocations: mock thenReturn when getAttribute thenReturn when getAttribute thenReturn when getAttributeNamesWithValues asList mock addHttpSessionListener sessionDestroyed valueUnbound verify any sessionDestroyed verify any mock mock thenReturn when getAttribute thenReturn when getAttributeNamesWithValues asList addHttpSessionListener sessionDestroyed sessionDestroyed verify times any valueUnbound verify times any valueUnbound verify any sessionDestroyed verify any
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSessionDestroyed()
focal_class.declarator: descriptor
focal_class.modifier: private
focal_class.original_string: private ServletContextDescriptor descriptor;
focal_class.type: ServletContextDescriptor
focal_class.var_name: descriptor
focal_class.file: session-replacement/src/main/java/com/amadeus/session/servlet/HttpSessionNotifier.java
focal_class.identifier: HttpSessionNotifier
focal_class.interfaces: implements SessionNotifier
focal_class.class_method_signature: HttpSessionNotifier.HttpSessionNotifier(ServletContextDescriptor descriptor)
focal_class.full_signature:   HttpSessionNotifier(ServletContextDescriptor descriptor)
focal_class.identifier: HttpSessionNotifier
focal_class.parameters: (ServletContextDescriptor descriptor)
focal_class.signature:  HttpSessionNotifier(ServletContextDescriptor descriptor)
focal_class.class_method_signature: HttpSessionNotifier.sessionCreated(RepositoryBackedSession session)
focal_class.full_signature: @Override public void sessionCreated(RepositoryBackedSession session)
focal_class.identifier: sessionCreated
focal_class.modifiers: @Override public
focal_class.parameters: (RepositoryBackedSession session)
focal_class.return: void
focal_class.signature: void sessionCreated(RepositoryBackedSession session)
focal_class.class_method_signature: HttpSessionNotifier.attributeAdded(RepositoryBackedSession session, String key, Object value)
focal_class.full_signature: @Override public void attributeAdded(RepositoryBackedSession session, String key, Object value)
focal_class.identifier: attributeAdded
focal_class.modifiers: @Override public
focal_class.parameters: (RepositoryBackedSession session, String key, Object value)
focal_class.return: void
focal_class.signature: void attributeAdded(RepositoryBackedSession session, String key, Object value)
focal_class.class_method_signature: HttpSessionNotifier.attributeReplaced(RepositoryBackedSession session, String key, Object replacedValue)
focal_class.full_signature: @Override public void attributeReplaced(RepositoryBackedSession session, String key, Object replacedValue)
focal_class.identifier: attributeReplaced
focal_class.modifiers: @Override public
focal_class.parameters: (RepositoryBackedSession session, String key, Object replacedValue)
focal_class.return: void
focal_class.signature: void attributeReplaced(RepositoryBackedSession session, String key, Object replacedValue)
focal_class.class_method_signature: HttpSessionNotifier.attributeRemoved(RepositoryBackedSession session, String key, Object removedValue)
focal_class.full_signature: @Override public void attributeRemoved(RepositoryBackedSession session, String key, Object removedValue)
focal_class.identifier: attributeRemoved
focal_class.modifiers: @Override public
focal_class.parameters: (RepositoryBackedSession session, String key, Object removedValue)
focal_class.return: void
focal_class.signature: void attributeRemoved(RepositoryBackedSession session, String key, Object removedValue)
focal_class.class_method_signature: HttpSessionNotifier.attributeBeingStored(RepositoryBackedSession session, String key, Object value)
focal_class.full_signature: @Override public void attributeBeingStored(RepositoryBackedSession session, String key, Object value)
focal_class.identifier: attributeBeingStored
focal_class.modifiers: @Override public
focal_class.parameters: (RepositoryBackedSession session, String key, Object value)
focal_class.return: void
focal_class.signature: void attributeBeingStored(RepositoryBackedSession session, String key, Object value)
focal_class.class_method_signature: HttpSessionNotifier.attributeHasBeenRestored(RepositoryBackedSession session, String key, Object value)
focal_class.full_signature: @Override public void attributeHasBeenRestored(RepositoryBackedSession session, String key, Object value)
focal_class.identifier: attributeHasBeenRestored
focal_class.modifiers: @Override public
focal_class.parameters: (RepositoryBackedSession session, String key, Object value)
focal_class.return: void
focal_class.signature: void attributeHasBeenRestored(RepositoryBackedSession session, String key, Object value)
focal_class.class_method_signature: HttpSessionNotifier.sessionDestroyed(RepositoryBackedSession session, boolean shutdown)
focal_class.full_signature: @Override public void sessionDestroyed(RepositoryBackedSession session, boolean shutdown)
focal_class.identifier: sessionDestroyed
focal_class.modifiers: @Override public
focal_class.parameters: (RepositoryBackedSession session, boolean shutdown)
focal_class.return: void
focal_class.signature: void sessionDestroyed(RepositoryBackedSession session, boolean shutdown)
focal_class.class_method_signature: HttpSessionNotifier.sessionIdChanged(RepositoryBackedSession session, String oldId)
focal_class.full_signature: @Override public void sessionIdChanged(RepositoryBackedSession session, String oldId)
focal_class.identifier: sessionIdChanged
focal_class.modifiers: @Override public
focal_class.parameters: (RepositoryBackedSession session, String oldId)
focal_class.return: void
focal_class.signature: void sessionIdChanged(RepositoryBackedSession session, String oldId)
focal_method.body: @Override
    public void sessionDestroyed(RepositoryBackedSession session, boolean shutdown) {
      if (session instanceof HttpSession) {
        // We notify all session attribute listeners that each attribute is removed
        for (String key : session.getAttributeNamesWithValues()) {
          HttpSessionBindingEvent event = new HttpSessionBindingEvent((HttpSession)session, key);
          Object value = session.getAttribute(key);
          if (value instanceof HttpSessionBindingListener) {
            ((HttpSessionBindingListener)value).valueUnbound(event);
          }
          for (HttpSessionAttributeListener listener : descriptor.getHttpSessionAttributeListeners()) {
            listener.attributeRemoved(event);
          }
        }
        // Notifying HttpSessionListeners. If we are doing shutdown, as per
        // Servlet specification, we notify listeners in reverse order
        HttpSessionEvent event = new HttpSessionEvent((HttpSession)session);
        if (shutdown) {
          List<HttpSessionListener> listeners = descriptor.getHttpSessionListeners();
          for (int i = listeners.size() - 1; i >= 0; i--) {
            listeners.get(i).sessionDestroyed(event);
          }
        } else {
          for (HttpSessionListener listener : descriptor.getHttpSessionListeners()) {
            listener.sessionDestroyed(event);
          }
        }
      }
    }
focal_method.class_method_signature: HttpSessionNotifier.sessionDestroyed(RepositoryBackedSession session, boolean shutdown)
focal_method.full_signature: @Override public void sessionDestroyed(RepositoryBackedSession session, boolean shutdown)
focal_method.identifier: sessionDestroyed
focal_method.invocations: getAttributeNamesWithValues getAttribute valueUnbound getHttpSessionAttributeListeners attributeRemoved getHttpSessionListeners size sessionDestroyed get getHttpSessionListeners sessionDestroyed
focal_method.modifiers: @Override public
focal_method.parameters: (RepositoryBackedSession session, boolean shutdown)
focal_method.return: void
focal_method.signature: void sessionDestroyed(RepositoryBackedSession session, boolean shutdown)