Search in sources :

Example 1 with SimpleAssertion

use of com.sun.xml.ws.policy.SimpleAssertion 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 2 with SimpleAssertion

use of com.sun.xml.ws.policy.SimpleAssertion 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 3 with SimpleAssertion

use of com.sun.xml.ws.policy.SimpleAssertion 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)

Example 4 with SimpleAssertion

use of com.sun.xml.ws.policy.SimpleAssertion 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 5 with SimpleAssertion

use of com.sun.xml.ws.policy.SimpleAssertion 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)

Aggregations

ImplementationRecord (com.sun.xml.ws.api.config.management.policy.ManagedServiceAssertion.ImplementationRecord)7 PolicyAssertion (com.sun.xml.ws.policy.PolicyAssertion)7 SimpleAssertion (com.sun.xml.ws.policy.SimpleAssertion)7 AssertionData (com.sun.xml.ws.policy.sourcemodel.AssertionData)7 HashMap (java.util.HashMap)7 LinkedList (java.util.LinkedList)7 QName (javax.xml.namespace.QName)7 NestedParameters (com.sun.xml.ws.api.config.management.policy.ManagedServiceAssertion.NestedParameters)5