Search in sources :

Example 1 with CompressionFeature

use of org.talend.esb.policy.compression.feature.CompressionFeature in project tesb-rt-se by Talend.

the class CompressionFeatureTest method removeInterceptors.

@Test
public void removeInterceptors() {
    final List<Interceptor<? extends Message>> outInterceptors = new ArrayList<Interceptor<? extends Message>>();
    outInterceptors.add(new CompressionOutInterceptor());
    outInterceptors.add(new CompressionOutInterceptor());
    final List<Interceptor<? extends Message>> outFaultInterceptors = new ArrayList<Interceptor<? extends Message>>();
    outFaultInterceptors.add(new CompressionOutInterceptor());
    outFaultInterceptors.add(new CompressionOutInterceptor());
    final List<Interceptor<? extends Message>> inInterceptors = new ArrayList<Interceptor<? extends Message>>();
    inInterceptors.add(new CompressionInInterceptor());
    final List<Interceptor<? extends Message>> inFaultInterceptors = new ArrayList<Interceptor<? extends Message>>();
    inFaultInterceptors.add(new CompressionInInterceptor());
    InterceptorProvider interceptorProvider = new InterceptorProvider() {

        @Override
        public List<Interceptor<? extends Message>> getOutInterceptors() {
            return outInterceptors;
        }

        @Override
        public List<Interceptor<? extends Message>> getOutFaultInterceptors() {
            return outFaultInterceptors;
        }

        @Override
        public List<Interceptor<? extends Message>> getInInterceptors() {
            return inInterceptors;
        }

        @Override
        public List<Interceptor<? extends Message>> getInFaultInterceptors() {
            return inFaultInterceptors;
        }
    };
    CompressionFeature f = new CompressionFeature();
    f.initialize(interceptorProvider, null);
    assertTrue(outInterceptors.size() == 1);
    assertTrue(outFaultInterceptors.size() == 1);
    assertTrue(inInterceptors.size() == 2);
    assertTrue(inFaultInterceptors.size() == 1);
}
Also used : Message(org.apache.cxf.message.Message) CompressionOutInterceptor(org.talend.esb.policy.compression.impl.CompressionOutInterceptor) CompressionFeature(org.talend.esb.policy.compression.feature.CompressionFeature) ArrayList(java.util.ArrayList) InterceptorProvider(org.apache.cxf.interceptor.InterceptorProvider) Interceptor(org.apache.cxf.interceptor.Interceptor) CompressionOutInterceptor(org.talend.esb.policy.compression.impl.CompressionOutInterceptor) CompressionInInterceptor(org.talend.esb.policy.compression.impl.CompressionInInterceptor) CompressionInInterceptor(org.talend.esb.policy.compression.impl.CompressionInInterceptor) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 Interceptor (org.apache.cxf.interceptor.Interceptor)1 InterceptorProvider (org.apache.cxf.interceptor.InterceptorProvider)1 Message (org.apache.cxf.message.Message)1 Test (org.junit.Test)1 CompressionFeature (org.talend.esb.policy.compression.feature.CompressionFeature)1 CompressionInInterceptor (org.talend.esb.policy.compression.impl.CompressionInInterceptor)1 CompressionOutInterceptor (org.talend.esb.policy.compression.impl.CompressionOutInterceptor)1