Package org.apache.cxf.transport.http.policy.impl

Examples of org.apache.cxf.transport.http.policy.impl.ServerPolicyCalculator


        assertTrue("Policies are compatible.", spc.compatible(p1, p2));
    }
       
    @Test
    public void testIntersectServerPolicies() {
        ServerPolicyCalculator spc = new ServerPolicyCalculator();
        HTTPServerPolicy p1 = new HTTPServerPolicy();
        HTTPServerPolicy p2 = new HTTPServerPolicy();
        HTTPServerPolicy p = null;

        p1.setServerType("server");
        p = spc.intersect(p1, p2);
        assertEquals("server", p.getServerType());
        p1.setServerType(null);
        p1.setReceiveTimeout(10000L);
        p = spc.intersect(p1, p2);
        assertEquals(10000L, p.getReceiveTimeout());
        p1.setSuppressClientSendErrors(true);
        p2.setSuppressClientSendErrors(true);
        p = spc.intersect(p1, p2);
        assertTrue(p.isSuppressClientSendErrors());
    }
View Full Code Here


    }

   
    @Test
    public void testEqualServerPolicies() {
        ServerPolicyCalculator spc = new ServerPolicyCalculator();
        HTTPServerPolicy p1 = new HTTPServerPolicy();
        assertTrue(spc.equals(p1, p1));
        HTTPServerPolicy p2 = new HTTPServerPolicy();       
        assertTrue(spc.equals(p1, p2));
        p1.setContentEncoding("encoding");
        assertTrue(!spc.equals(p1, p2));
        p2.setContentEncoding("encoding");
        assertTrue(spc.equals(p1, p2));
        p1.setSuppressClientSendErrors(true);
        assertTrue(!spc.equals(p1, p2));
    }
View Full Code Here

        EasyMock.expect(message.get(AssertionInfoMap.class)).andReturn(aim);
        control.replay();
        if (isRequestor) {
            pde.assertMessage(message, null, new ClientPolicyCalculator());
        } else {
            pde.assertMessage(message, null, new ServerPolicyCalculator());
        }
        control.verify();
    }
View Full Code Here

        testAssertServerPolicy(false);
    }
   
    public AssertionInfo getServerPolicyAssertionInfo(HTTPServerPolicy policy) {
        JaxbAssertion<HTTPServerPolicy> assertion =
            new JaxbAssertion<HTTPServerPolicy>(new ServerPolicyCalculator().getDataClassName(), false);
        assertion.setData(policy);
        return new AssertionInfo(assertion);
    }
View Full Code Here

        ais.add(mai);
        ais.add(cmai);
        ais.add(icmai);
        AssertionInfoMap aim = new AssertionInfoMap(CastUtils.cast(Collections.EMPTY_LIST,
                                                                   PolicyAssertion.class));
        aim.put(new ServerPolicyCalculator().getDataClassName(), ais);
        EasyMock.expect(message.get(AssertionInfoMap.class)).andReturn(aim).atLeastOnce();
        Exchange ex = control.createMock(Exchange.class);
        EasyMock.expect(message.getExchange()).andReturn(ex).atLeastOnce();
        EasyMock.expect(ex.getOutMessage()).andReturn(outbound ? message : null).atLeastOnce();
        if (!outbound) {
            EasyMock.expect(ex.getOutFaultMessage()).andReturn(null).atLeastOnce();
        }

        control.replay();
        new PolicyDataEngineImpl(null).assertMessage(message, ep,
                                                     new ServerPolicyCalculator());
        assertTrue(eai.isAsserted());
        assertTrue(mai.isAsserted());
        assertTrue(outbound ? cmai.isAsserted() : !cmai.isAsserted());
        assertTrue(outbound ? icmai.isAsserted() : !icmai.isAsserted());
        control.verify();
View Full Code Here

    public void testBuildAssertion() throws Exception {
        HTTPServerAssertionBuilder ab = new HTTPServerAssertionBuilder();
        Assertion a = ab.buildAssertion();
        assertTrue(a instanceof JaxbAssertion);
        assertTrue(a instanceof HTTPServerAssertionBuilder.HTTPServerPolicyAssertion);
        assertEquals(new ServerPolicyCalculator().getDataClassName(), a.getName());
        assertTrue(!a.isOptional());
    }
View Full Code Here

    private synchronized HTTPServerPolicy calcServerPolicyInternal(Message m) {
        HTTPServerPolicy sp = serverPolicy;
        if (!serverPolicyCalced) {
            PolicyDataEngine pde = bus.getExtension(PolicyDataEngine.class);
            if (pde != null) {
                sp = pde.getServerEndpointPolicy(m, endpointInfo, this, new ServerPolicyCalculator());
            }
            if (null == sp) {
                sp = endpointInfo.getTraversedExtensor(
                        new HTTPServerPolicy(), HTTPServerPolicy.class);
            }
View Full Code Here

        }
    }
   
    public void assertMessage(Message message) {
        PolicyDataEngine pde = bus.getExtension(PolicyDataEngine.class);
        pde.assertMessage(message, calcServerPolicy(message), new ServerPolicyCalculator());
    }
View Full Code Here

        PolicyDataEngine pde = bus.getExtension(PolicyDataEngine.class);
        pde.assertMessage(message, calcServerPolicy(message), new ServerPolicyCalculator());
    }

    public boolean canAssert(QName type) {
        return new ServerPolicyCalculator().getDataClassName().equals(type);
    }
View Full Code Here

    }

    private void initConfig() {
        PolicyDataEngine pde = bus.getExtension(PolicyDataEngine.class);
        if (pde != null) {
            server = pde.getServerEndpointPolicy(endpointInfo, this, new ServerPolicyCalculator());
        }
        if (null == server && WSDLLibrary.isAvailable()) {
            server = endpointInfo.getTraversedExtensor(
                    new HTTPServerPolicy(), HTTPServerPolicy.class);
        }
View Full Code Here

TOP

Related Classes of org.apache.cxf.transport.http.policy.impl.ServerPolicyCalculator

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.