Search in sources :

Example 36 with AssertionData

use of com.sun.xml.ws.policy.sourcemodel.AssertionData in project metro-jax-ws by eclipse-ee4j.

the class ManagedServiceAssertionTest method testGetCommunicationServerImplementations.

/**
 * Test of getCommunicationServerImplementations method, of class ManagedServiceAssertion.
 */
public void testGetCommunicationServerImplementations() throws AssertionCreationException {
    final HashMap<QName, String> implementationAttributes = new HashMap<QName, String>();
    implementationAttributes.put(CLASS_NAME_ATTRIBUTE_QNAME, "CommunicationServerTestClass");
    final AssertionData implementationData = AssertionData.createAssertionData(COMMUNICATION_SERVER_IMPLEMENTATION_PARAMETER_QNAME, null, implementationAttributes, false, false);
    final PolicyAssertion implementationParameter = new SimpleAssertion(implementationData, null) {
    };
    final LinkedList<PolicyAssertion> implementationsParameters = new LinkedList<PolicyAssertion>();
    implementationsParameters.add(implementationParameter);
    final AssertionData implementationsData = AssertionData.createAssertionData(COMMUNICATION_SERVER_IMPLEMENTATIONS_PARAMETER_QNAME, null, null, false, false);
    final PolicyAssertion implementationsParameter = new SimpleAssertion(implementationsData, implementationsParameters) {
    };
    final LinkedList<PolicyAssertion> managedServiceParameters = new LinkedList<PolicyAssertion>();
    managedServiceParameters.add(implementationsParameter);
    final HashMap<QName, String> managedServiceAttributes = new HashMap<QName, String>();
    managedServiceAttributes.put(ID_ATTRIBUTE_QNAME, "id1");
    final AssertionData managedServiceData = AssertionData.createAssertionData(ManagedServiceAssertion.MANAGED_SERVICE_QNAME, null, managedServiceAttributes, false, false);
    final ManagedServiceAssertion instance = new ManagedServiceAssertion(managedServiceData, managedServiceParameters);
    final HashMap<QName, String> expMap = new HashMap<QName, String>();
    final ImplementationRecord expResult = new ImplementationRecord("CommunicationServerTestClass", expMap, new LinkedList<NestedParameters>());
    final Collection<ImplementationRecord> records = instance.getCommunicationServerImplementations();
    assertEquals(1, records.size());
    final ImplementationRecord record = records.iterator().next();
    assertEquals(expResult, record);
}
Also used : PolicyAssertion(com.sun.xml.ws.policy.PolicyAssertion) HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) SimpleAssertion(com.sun.xml.ws.policy.SimpleAssertion) ImplementationRecord(com.sun.xml.ws.api.config.management.policy.ManagedServiceAssertion.ImplementationRecord) LinkedList(java.util.LinkedList) NestedParameters(com.sun.xml.ws.api.config.management.policy.ManagedServiceAssertion.NestedParameters) AssertionData(com.sun.xml.ws.policy.sourcemodel.AssertionData)

Example 37 with AssertionData

use of com.sun.xml.ws.policy.sourcemodel.AssertionData in project metro-jax-ws by eclipse-ee4j.

the class ManagedServiceAssertionTest method testMonitoringAttributeOff.

public void testMonitoringAttributeOff() throws AssertionCreationException {
    final HashMap<QName, String> attributes = new HashMap<QName, String>();
    attributes.put(ID_ATTRIBUTE_QNAME, "id1");
    attributes.put(MONITORING_ATTRIBUTE_QNAME, "off");
    final AssertionData data = AssertionData.createAssertionData(ManagedServiceAssertion.MANAGED_SERVICE_QNAME, null, attributes, false, false);
    final ManagedServiceAssertion instance = new ManagedServiceAssertion(data, null);
    final Setting result = instance.monitoringAttribute();
    assertSame(Setting.OFF, result);
}
Also used : HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) Setting(com.sun.xml.ws.api.config.management.policy.ManagementAssertion.Setting) AssertionData(com.sun.xml.ws.policy.sourcemodel.AssertionData)

Example 38 with AssertionData

use of com.sun.xml.ws.policy.sourcemodel.AssertionData in project metro-jax-ws by eclipse-ee4j.

the class ManagedServiceAssertionTest method testGetCommunicationServerConnectorServerEnvironment.

public void testGetCommunicationServerConnectorServerEnvironment() throws AssertionCreationException {
    final QName parameterName = new QName("ParameterName");
    final AssertionData nestedData = AssertionData.createAssertionData(parameterName, "parameterValue", null, false, false);
    final LinkedList<PolicyAssertion> nestedAssertions = new LinkedList<PolicyAssertion>();
    nestedAssertions.add(new SimpleAssertion(nestedData, null) {
    });
    final AssertionData environmentData = AssertionData.createAssertionData(new QName(PolicyConstants.SUN_MANAGEMENT_NAMESPACE, "JmxConnectorServerEnviroment"), null, null, false, false);
    final LinkedList<PolicyAssertion> environmentParameters = new LinkedList<PolicyAssertion>();
    environmentParameters.add(new SimpleAssertion(environmentData, nestedAssertions) {
    });
    final AssertionData commServerData = AssertionData.createAssertionData(COMMUNICATION_SERVER_IMPLEMENTATION_PARAMETER_QNAME, null, null, false, false);
    final LinkedList<PolicyAssertion> commServerParameters = new LinkedList<PolicyAssertion>();
    commServerParameters.add(new SimpleAssertion(commServerData, environmentParameters) {
    });
    final AssertionData commServersData = AssertionData.createAssertionData(COMMUNICATION_SERVER_IMPLEMENTATIONS_PARAMETER_QNAME, null, null, false, false);
    final LinkedList<PolicyAssertion> managedServiceParameters = new LinkedList<PolicyAssertion>();
    managedServiceParameters.add(new SimpleAssertion(commServersData, commServerParameters) {
    });
    final HashMap<QName, String> managedServiceAttributes = new HashMap<QName, String>();
    managedServiceAttributes.put(ID_ATTRIBUTE_QNAME, "id1");
    final AssertionData managedServiceData = AssertionData.createAssertionData(ManagedServiceAssertion.MANAGED_SERVICE_QNAME, null, managedServiceAttributes, false, false);
    final ManagedServiceAssertion instance = new ManagedServiceAssertion(managedServiceData, managedServiceParameters);
    final Collection<ImplementationRecord> implementations = instance.getCommunicationServerImplementations();
    final ImplementationRecord implementation = implementations.iterator().next();
    final Collection<NestedParameters> nestedParameters = implementation.getNestedParameters();
    final NestedParameters nestedParameter = nestedParameters.iterator().next();
    final QName nestedName = nestedParameter.getName();
    assertEquals("JmxConnectorServerEnviroment", nestedName.getLocalPart());
    final Map<QName, String> result = nestedParameter.getParameters();
    final Map<QName, String> expResult = new HashMap<QName, String>();
    expResult.put(parameterName, "parameterValue");
    assertEquals(expResult, result);
}
Also used : PolicyAssertion(com.sun.xml.ws.policy.PolicyAssertion) HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) SimpleAssertion(com.sun.xml.ws.policy.SimpleAssertion) ImplementationRecord(com.sun.xml.ws.api.config.management.policy.ManagedServiceAssertion.ImplementationRecord) LinkedList(java.util.LinkedList) NestedParameters(com.sun.xml.ws.api.config.management.policy.ManagedServiceAssertion.NestedParameters) AssertionData(com.sun.xml.ws.policy.sourcemodel.AssertionData)

Example 39 with AssertionData

use of com.sun.xml.ws.policy.sourcemodel.AssertionData in project metro-jax-ws by eclipse-ee4j.

the class ManagedServiceAssertionTest method testEndpointDisposeDelayDefault.

public void testEndpointDisposeDelayDefault() throws AssertionCreationException {
    final HashMap<QName, String> attributes = new HashMap<QName, String>();
    attributes.put(ID_ATTRIBUTE_QNAME, "id1");
    final AssertionData data = AssertionData.createAssertionData(ManagedServiceAssertion.MANAGED_SERVICE_QNAME, null, attributes, false, false);
    final ManagedServiceAssertion instance = new ManagedServiceAssertion(data, null);
    final long result = instance.getEndpointDisposeDelay(2000l);
    assertEquals(2000l, result);
}
Also used : HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) AssertionData(com.sun.xml.ws.policy.sourcemodel.AssertionData)

Example 40 with AssertionData

use of com.sun.xml.ws.policy.sourcemodel.AssertionData in project metro-jax-ws by eclipse-ee4j.

the class ManagedServiceAssertionTest method testNoId.

/**
 * Test of getId method, of class ManagedServiceAssertion.
 */
public void testNoId() {
    final HashMap<QName, String> attributes = new HashMap<QName, String>();
    final AssertionData data = AssertionData.createAssertionData(ManagedServiceAssertion.MANAGED_SERVICE_QNAME, null, attributes, false, false);
    try {
        ManagedServiceAssertion instance = new ManagedServiceAssertion(data, null);
        fail("Expected AssertionCreationException because the ServerManagedServiceAssertion requires an id attribute.");
    } catch (AssertionCreationException e) {
    // expected
    }
}
Also used : AssertionCreationException(com.sun.xml.ws.policy.spi.AssertionCreationException) HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) AssertionData(com.sun.xml.ws.policy.sourcemodel.AssertionData)

Aggregations

AssertionData (com.sun.xml.ws.policy.sourcemodel.AssertionData)54 QName (javax.xml.namespace.QName)49 HashMap (java.util.HashMap)39 LinkedList (java.util.LinkedList)16 Setting (com.sun.xml.ws.api.config.management.policy.ManagementAssertion.Setting)10 PolicyAssertion (com.sun.xml.ws.policy.PolicyAssertion)9 ImplementationRecord (com.sun.xml.ws.api.config.management.policy.ManagedServiceAssertion.ImplementationRecord)7 SimpleAssertion (com.sun.xml.ws.policy.SimpleAssertion)7 NestedParameters (com.sun.xml.ws.api.config.management.policy.ManagedServiceAssertion.NestedParameters)5 ModelNode (com.sun.xml.ws.policy.sourcemodel.ModelNode)3 PolicySourceModel (com.sun.xml.ws.policy.sourcemodel.PolicySourceModel)3 AssertionSet (com.sun.xml.ws.policy.AssertionSet)2 PolicyModelTranslator (com.sun.xml.ws.policy.sourcemodel.PolicyModelTranslator)2 ModelTranslator (com.sun.xml.ws.api.policy.ModelTranslator)1 Policy (com.sun.xml.ws.policy.Policy)1 AssertionCreationException (com.sun.xml.ws.policy.spi.AssertionCreationException)1 WebServiceException (jakarta.xml.ws.WebServiceException)1 AddressingFeature (jakarta.xml.ws.soap.AddressingFeature)1 StringReader (java.io.StringReader)1 URI (java.net.URI)1