@Test public void stanzaWithHintStoreShouldBeStored() throws ProtocolException { Stanza stanza = StanzaBuilder.createMessageStanza(ALICE, BOB, "en", null) .startInnerElement("store", NamespaceURIs.XEP0334_MESSAGE_PROCESSING_HINTS).endInnerElement().build(); tested.intercept(stanza, serverRuntimeContext, false, sessionContext, sessionStateHolder, nonArchivingStanzaBroker, interceptorChain); verify(interceptorChain).intercept(stanza, serverRuntimeContext, false, sessionContext, sessionStateHolder, archivingStanzaBroker); assertTrue(mamStanzaBrokerProvider.archivingForced); }
@Override public void intercept(Stanza stanza, ServerRuntimeContext serverRuntimeContext, boolean isOutboundStanza, SessionContext sessionContext, SessionStateHolder sessionStateHolder, StanzaBroker stanzaBroker, StanzaHandlerInterceptorChain interceptorChain) throws ProtocolException { StanzaBroker stanzaBrokerToUse; if (isCandidateForArchiving(stanza)) { stanzaBrokerToUse = stanzaBrokerProviders.stream() .filter(mamStanzaBrokerProvider -> mamStanzaBrokerProvider.supports(stanza, serverRuntimeContext)) .map(mamStanzaBrokerProvider -> mamStanzaBrokerProvider.proxy(stanzaBroker, serverRuntimeContext, sessionContext, isOutboundStanza, isArchivingForced(stanza))) .findFirst().orElse(stanzaBroker); } else { stanzaBrokerToUse = stanzaBroker; } interceptorChain.intercept(stanza, serverRuntimeContext, isOutboundStanza, sessionContext, sessionStateHolder, stanzaBrokerToUse); }
MAMStanzaHandlerInterceptor implements StanzaHandlerInterceptor { @Override public void intercept(Stanza stanza, ServerRuntimeContext serverRuntimeContext, boolean isOutboundStanza, SessionContext sessionContext, SessionStateHolder sessionStateHolder, StanzaBroker stanzaBroker, StanzaHandlerInterceptorChain interceptorChain) throws ProtocolException { StanzaBroker stanzaBrokerToUse; if (isCandidateForArchiving(stanza)) { stanzaBrokerToUse = stanzaBrokerProviders.stream() .filter(mamStanzaBrokerProvider -> mamStanzaBrokerProvider.supports(stanza, serverRuntimeContext)) .map(mamStanzaBrokerProvider -> mamStanzaBrokerProvider.proxy(stanzaBroker, serverRuntimeContext, sessionContext, isOutboundStanza, isArchivingForced(stanza))) .findFirst().orElse(stanzaBroker); } else { stanzaBrokerToUse = stanzaBroker; } interceptorChain.intercept(stanza, serverRuntimeContext, isOutboundStanza, sessionContext, sessionStateHolder, stanzaBrokerToUse); } }
MAMStanzaHandlerInterceptor implements StanzaHandlerInterceptor { @Override public void intercept(Stanza stanza, ServerRuntimeContext serverRuntimeContext, boolean isOutboundStanza, SessionContext sessionContext, SessionStateHolder sessionStateHolder, StanzaBroker stanzaBroker, StanzaHandlerInterceptorChain interceptorChain) throws ProtocolException { StanzaBroker stanzaBrokerToUse; if (isCandidateForArchiving(stanza)) { stanzaBrokerToUse = stanzaBrokerProviders.stream() .filter(mamStanzaBrokerProvider -> mamStanzaBrokerProvider.supports(stanza, serverRuntimeContext)) .map(mamStanzaBrokerProvider -> mamStanzaBrokerProvider.proxy(stanzaBroker, serverRuntimeContext, sessionContext, isOutboundStanza, isArchivingForced(stanza))) .findFirst().orElse(stanzaBroker); } else { stanzaBrokerToUse = stanzaBroker; } interceptorChain.intercept(stanza, serverRuntimeContext, isOutboundStanza, sessionContext, sessionStateHolder, stanzaBrokerToUse); } MAMStanzaHandlerInterceptor();   MAMStanzaHandlerInterceptor(List<MAMStanzaBrokerProvider> stanzaBrokerProviders); }
MAMStanzaHandlerInterceptor implements StanzaHandlerInterceptor { @Override public void intercept(Stanza stanza, ServerRuntimeContext serverRuntimeContext, boolean isOutboundStanza, SessionContext sessionContext, SessionStateHolder sessionStateHolder, StanzaBroker stanzaBroker, StanzaHandlerInterceptorChain interceptorChain) throws ProtocolException { StanzaBroker stanzaBrokerToUse; if (isCandidateForArchiving(stanza)) { stanzaBrokerToUse = stanzaBrokerProviders.stream() .filter(mamStanzaBrokerProvider -> mamStanzaBrokerProvider.supports(stanza, serverRuntimeContext)) .map(mamStanzaBrokerProvider -> mamStanzaBrokerProvider.proxy(stanzaBroker, serverRuntimeContext, sessionContext, isOutboundStanza, isArchivingForced(stanza))) .findFirst().orElse(stanzaBroker); } else { stanzaBrokerToUse = stanzaBroker; } interceptorChain.intercept(stanza, serverRuntimeContext, isOutboundStanza, sessionContext, sessionStateHolder, stanzaBrokerToUse); } MAMStanzaHandlerInterceptor();   MAMStanzaHandlerInterceptor(List<MAMStanzaBrokerProvider> stanzaBrokerProviders); @Override void intercept(Stanza stanza, ServerRuntimeContext serverRuntimeContext, boolean isOutboundStanza,
            SessionContext sessionContext, SessionStateHolder sessionStateHolder, StanzaBroker stanzaBroker,
            StanzaHandlerInterceptorChain interceptorChain); }
MAMStanzaHandlerInterceptor implements StanzaHandlerInterceptor { @Override public void intercept(Stanza stanza, ServerRuntimeContext serverRuntimeContext, boolean isOutboundStanza, SessionContext sessionContext, SessionStateHolder sessionStateHolder, StanzaBroker stanzaBroker, StanzaHandlerInterceptorChain interceptorChain) throws ProtocolException { StanzaBroker stanzaBrokerToUse; if (isCandidateForArchiving(stanza)) { stanzaBrokerToUse = stanzaBrokerProviders.stream() .filter(mamStanzaBrokerProvider -> mamStanzaBrokerProvider.supports(stanza, serverRuntimeContext)) .map(mamStanzaBrokerProvider -> mamStanzaBrokerProvider.proxy(stanzaBroker, serverRuntimeContext, sessionContext, isOutboundStanza, isArchivingForced(stanza))) .findFirst().orElse(stanzaBroker); } else { stanzaBrokerToUse = stanzaBroker; } interceptorChain.intercept(stanza, serverRuntimeContext, isOutboundStanza, sessionContext, sessionStateHolder, stanzaBrokerToUse); } MAMStanzaHandlerInterceptor();   MAMStanzaHandlerInterceptor(List<MAMStanzaBrokerProvider> stanzaBrokerProviders); @Override void intercept(Stanza stanza, ServerRuntimeContext serverRuntimeContext, boolean isOutboundStanza,
            SessionContext sessionContext, SessionStateHolder sessionStateHolder, StanzaBroker stanzaBroker,
            StanzaHandlerInterceptorChain interceptorChain);  }