Search in sources :

Example 11 with AssertionData

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

the class ManagedServiceAssertionTest method testMonitoringAttributeFalse.

public void testMonitoringAttributeFalse() throws AssertionCreationException {
    final HashMap<QName, String> attributes = new HashMap<QName, String>();
    attributes.put(ID_ATTRIBUTE_QNAME, "id1");
    attributes.put(MONITORING_ATTRIBUTE_QNAME, "false");
    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 12 with AssertionData

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

the class ManagedServiceAssertionTest method testGetConfigReaderImplementation.

/**
 * Test of getConfigReaderImplementation method, of class ManagedServiceAssertion.
 */
public void testGetConfigReaderImplementation() throws AssertionCreationException {
    final HashMap<QName, String> configReaderAttributes = new HashMap<QName, String>();
    configReaderAttributes.put(CLASS_NAME_ATTRIBUTE_QNAME, "ConfigReaderTestClass");
    final AssertionData configReaderData = AssertionData.createAssertionData(CONFIG_READER_IMPLEMENTATION_PARAMETER_QNAME, null, configReaderAttributes, false, false);
    final PolicyAssertion configReaderParameter = new SimpleAssertion(configReaderData, null) {
    };
    final LinkedList<PolicyAssertion> managedServiceParameters = new LinkedList<PolicyAssertion>();
    managedServiceParameters.add(configReaderParameter);
    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>();
    ImplementationRecord expResult = new ImplementationRecord("ConfigReaderTestClass", expMap, new LinkedList<NestedParameters>());
    ImplementationRecord result = instance.getConfigReaderImplementation();
    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 13 with AssertionData

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

the class ManagedServiceAssertionTest method testGetCommunicationServerJmxServerUrl.

public void testGetCommunicationServerJmxServerUrl() throws AssertionCreationException {
    final QName jmxServerUrlName = new QName(PolicyConstants.SUN_MANAGEMENT_NAMESPACE, "JmxServerUrl");
    final AssertionData environmentData = AssertionData.createAssertionData(jmxServerUrlName, "http://localhost/", null, false, false);
    final LinkedList<PolicyAssertion> environmentParameters = new LinkedList<PolicyAssertion>();
    environmentParameters.add(new SimpleAssertion(environmentData, null) {
    });
    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 Map<QName, String> result = implementation.getParameters();
    final Map<QName, String> expResult = new HashMap<QName, String>();
    expResult.put(jmxServerUrlName, "http://localhost/");
    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) AssertionData(com.sun.xml.ws.policy.sourcemodel.AssertionData)

Example 14 with AssertionData

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

the class ManagedServiceAssertionTest method testNoIdManagementDisabled.

/**
 * Test of getId method, of class ManagedServiceAssertion.
 */
public void testNoIdManagementDisabled() throws AssertionCreationException {
    final HashMap<QName, String> attributes = new HashMap<QName, String>();
    attributes.put(MANAGEMENT_ATTRIBUTE_QNAME, "false");
    final AssertionData data = AssertionData.createAssertionData(ManagedServiceAssertion.MANAGED_SERVICE_QNAME, null, attributes, false, false);
    ManagedServiceAssertion instance = new ManagedServiceAssertion(data, null);
    String result = instance.getId();
    assertNull(result);
}
Also used : HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) AssertionData(com.sun.xml.ws.policy.sourcemodel.AssertionData)

Example 15 with AssertionData

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

the class ManagedServiceAssertionTest method testGetConfiguratorImplementation.

/**
 * Test of getConfiguratorImplementation method, of class ManagedServiceAssertion.
 */
public void testGetConfiguratorImplementation() throws AssertionCreationException {
    final HashMap<QName, String> configuratorAttributes = new HashMap<QName, String>();
    configuratorAttributes.put(CLASS_NAME_ATTRIBUTE_QNAME, "ConfiguratorTestClass");
    final AssertionData configuratorData = AssertionData.createAssertionData(CONFIGURATOR_IMPLEMENTATION_PARAMETER_QNAME, null, configuratorAttributes, false, false);
    final PolicyAssertion configuratorParameter = new SimpleAssertion(configuratorData, null) {
    };
    final LinkedList<PolicyAssertion> managedServiceParameters = new LinkedList<PolicyAssertion>();
    managedServiceParameters.add(configuratorParameter);
    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>();
    ImplementationRecord expResult = new ImplementationRecord("ConfiguratorTestClass", expMap, new LinkedList<NestedParameters>());
    ImplementationRecord result = instance.getConfiguratorImplementation();
    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)

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