This closes #173

This commit is contained in:
jbertram 2015-09-22 14:02:47 -05:00
commit d88097794c
2 changed files with 0 additions and 64 deletions

View File

@ -696,11 +696,6 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen
propsNotSet.add(new PropertyDescriptor("subscriptionName", ActiveMQActivationSpec.class)); propsNotSet.add(new PropertyDescriptor("subscriptionName", ActiveMQActivationSpec.class));
errorMessages.add("If subscription is durable then subscription name must be specified."); errorMessages.add("If subscription is durable then subscription name must be specified.");
} }
if ((isSubscriptionDurable() && getClientID() == null) || (isSubscriptionDurable() && getClientID() != null && getClientID().length() == 0)) {
propsNotSet.add(new PropertyDescriptor("clientID", ActiveMQActivationSpec.class));
errorMessages.add("If subscription is durable then clientID must be specified.");
}
} }
catch (IntrospectionException e) { catch (IntrospectionException e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -714,65 +714,6 @@ public class ActiveMQMessageHandlerTest extends ActiveMQRATestBase {
} }
} }
@Test
public void testNullClientID() throws Exception {
ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter();
MyBootstrapContext ctx = new MyBootstrapContext();
qResourceAdapter.start(ctx);
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
spec.setUseJNDI(false);
spec.setDestination("mdbTopic");
spec.setSubscriptionDurability("Durable");
spec.setSubscriptionName("sub");
spec.setSetupAttempts(1);
spec.setShareSubscriptions(true);
spec.setMaxSession(1);
CountDownLatch latch = new CountDownLatch(5);
DummyMessageEndpoint endpoint = new DummyMessageEndpoint(latch);
DummyMessageEndpointFactory endpointFactory = new DummyMessageEndpointFactory(endpoint, false);
try {
qResourceAdapter.endpointActivation(endpointFactory, spec);
fail();
}
catch (Exception e) {
assertTrue(e instanceof InvalidPropertyException);
assertEquals("clientID", ((InvalidPropertyException) e).getInvalidPropertyDescriptors()[0].getName());
}
}
@Test
public void testEmptyClientID() throws Exception {
ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter();
MyBootstrapContext ctx = new MyBootstrapContext();
qResourceAdapter.start(ctx);
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
spec.setUseJNDI(false);
spec.setDestination("mdbTopic");
spec.setSubscriptionDurability("Durable");
spec.setSubscriptionName("sub");
spec.setClientID("");
spec.setSetupAttempts(1);
spec.setShareSubscriptions(true);
spec.setMaxSession(1);
CountDownLatch latch = new CountDownLatch(5);
DummyMessageEndpoint endpoint = new DummyMessageEndpoint(latch);
DummyMessageEndpointFactory endpointFactory = new DummyMessageEndpointFactory(endpoint, false);
try {
qResourceAdapter.endpointActivation(endpointFactory, spec);
fail();
}
catch (Exception e) {
assertTrue(e instanceof InvalidPropertyException);
assertEquals("clientID", ((InvalidPropertyException) e).getInvalidPropertyDescriptors()[0].getName());
}
}
@Test @Test
public void testBadDestinationType() throws Exception { public void testBadDestinationType() throws Exception {
ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter(); ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter();