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);
}
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);
}
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);
}
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);
}
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
}
}
Aggregations