javax.resource.spi.InvalidPropertyException Java Examples
The following examples show how to use
javax.resource.spi.InvalidPropertyException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ActiveMQMessageHandlerTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Test public void testBadDestinationType() throws Exception { ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter(); MyBootstrapContext ctx = new MyBootstrapContext(); qResourceAdapter.start(ctx); ActiveMQActivationSpec spec = new ActiveMQActivationSpec(); spec.setResourceAdapter(qResourceAdapter); spec.setUseJNDI(false); spec.setDestinationType("badDestinationType"); spec.setDestination("mdbTopic"); 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("destinationType", ((InvalidPropertyException) e).getInvalidPropertyDescriptors()[0].getName()); } }
Example #2
Source File: JobSpec.java From tomee with Apache License 2.0 | 5 votes |
private Date parse(final String value) { final String[] formats = { "EEE MMM d HH:mm:ss z yyyy", "EEE, d MMM yyyy HH:mm:ss Z", "yyyy-MM-dd HH:mm:ss.S", "yyyy-MM-dd HH:mm:ss.SZ", "yyyy-MM-dd HH:mm:ss.S", "yyyy-MM-dd HH:mm:ssZ", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mmZ", "yyyy-MM-dd HH:mm", "yyyy-MM-dd'T'HH:mm:ss.SZ", "yyyy-MM-dd'T'HH:mm:ss.S", "yyyy-MM-dd'T'HH:mm:ssZ", "yyyy-MM-dd'T'HH:mm:ss", "yyyy-MM-dd'T'HH:mmZ", "yyyy-MM-dd'T'HH:mm", "yyyy-MM-dd", "yyyyMMdd" }; for (final String format : formats) { final SimpleDateFormat dateFormat = new SimpleDateFormat(format); try { return dateFormat.parse(value); } catch (final ParseException e) { invalidProperty = new InvalidPropertyException("Invalid time format " + value, e); } } return null; }
Example #3
Source File: ActiveMQMessageHandlerTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Test public void testNullSubscriptionName() 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.setClientID("id-1"); 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("subscriptionName", ((InvalidPropertyException) e).getInvalidPropertyDescriptors()[0].getName()); } }
Example #4
Source File: ActiveMQActivationValidationUtils.java From activemq-artemis with Apache License 2.0 | 5 votes |
private static void buildAndThrowExceptionIfNeeded(List<PropertyDescriptor> propsNotSet, List<String> errorMessages) throws InvalidPropertyException { if (propsNotSet.size() > 0) { StringBuffer b = new StringBuffer(); b.append("Invalid settings:"); for (String errorMessage : errorMessages) { b.append(" "); b.append(errorMessage); } InvalidPropertyException e = new InvalidPropertyException(b.toString()); final PropertyDescriptor[] descriptors = propsNotSet.toArray(new PropertyDescriptor[propsNotSet.size()]); e.setInvalidPropertyDescriptors(descriptors); throw e; } }
Example #5
Source File: ActiveMQActivationValidationUtils.java From activemq-artemis with Apache License 2.0 | 5 votes |
public static void validate(String destination, String destinationType, Boolean subscriptionDurability, String subscriptionName) throws InvalidPropertyException { List<String> errorMessages = new ArrayList<>(); List<PropertyDescriptor> propsNotSet = new ArrayList<>(); try { if (destination == null || destination.trim().equals("")) { propsNotSet.add(new PropertyDescriptor("destination", ActiveMQActivationSpec.class)); errorMessages.add("Destination is mandatory."); } if (destinationType != null && !Topic.class.getName().equals(destinationType) && !Queue.class.getName().equals(destinationType)) { propsNotSet.add(new PropertyDescriptor("destinationType", ActiveMQActivationSpec.class)); errorMessages.add("If set, the destinationType must be either 'javax.jms.Topic' or 'javax.jms.Queue'."); } if ((destinationType == null || destinationType.length() == 0 || Topic.class.getName().equals(destinationType)) && subscriptionDurability && (subscriptionName == null || subscriptionName.length() == 0)) { propsNotSet.add(new PropertyDescriptor("subscriptionName", ActiveMQActivationSpec.class)); errorMessages.add("If subscription is durable then subscription name must be specified."); } } catch (IntrospectionException e) { ActiveMQRALogger.LOGGER.unableToValidateProperties(e); } ActiveMQActivationValidationUtils.buildAndThrowExceptionIfNeeded(propsNotSet, errorMessages); }
Example #6
Source File: ActiveMQActivationSpec.java From activemq-artemis with Apache License 2.0 | 5 votes |
/** * Validate * * @throws InvalidPropertyException Thrown if a validation exception occurs */ @Override public void validate() throws InvalidPropertyException { if (logger.isTraceEnabled()) { logger.trace("validate()"); } ActiveMQActivationValidationUtils.validate(destination, destinationType, isSubscriptionDurable(), subscriptionName); }
Example #7
Source File: AnnotationDeployerTest.java From tomee with Apache License 2.0 | 4 votes |
public void validate() throws InvalidPropertyException { }
Example #8
Source File: JobSpec.java From tomee with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") @Override public void validate() throws InvalidPropertyException { if (invalidProperty != null) { throw invalidProperty; } final int i = hashCode(); detail = JobBuilder.newJob(QuartzResourceAdapter.JobEndpoint.class) .withIdentity("Job" + i, Scheduler.DEFAULT_GROUP) .withDescription(description) .requestRecovery(recoverable) .storeDurably(durable) .build(); final TriggerBuilder tb = TriggerBuilder.newTrigger() .forJob(detail) .withIdentity("Trigger" + i, Scheduler.DEFAULT_GROUP) .withDescription(description); if (startTime != null) { tb.startAt(parse(startTime)); } if (endTime != null) { tb.endAt(parse(endTime)); } if (calendarName != null) { tb.modifiedByCalendar(calendarName); } final CronScheduleBuilder csb = CronScheduleBuilder.cronSchedule(getCronExpression()); if (timeZone != null) { csb.inTimeZone(TimeZone.getTimeZone(timeZone)); } trigger = tb.withSchedule(csb).build(); try { ((CronTriggerImpl) trigger).validate(); } catch (final SchedulerException e) { throw new InvalidPropertyException(e); } }
Example #9
Source File: AutoConnectionTrackerTest.java From tomee with Apache License 2.0 | 4 votes |
public void validate() throws InvalidPropertyException { validated = true; }
Example #10
Source File: MdbConfigTest.java From tomee with Apache License 2.0 | 4 votes |
public void validate() throws InvalidPropertyException { validated = true; }
Example #11
Source File: AutoConfigMdbContainerTest.java From tomee with Apache License 2.0 | 4 votes |
public void validate() throws InvalidPropertyException { }
Example #12
Source File: TestActivationSpec.java From ironjacamar with Eclipse Public License 1.0 | 4 votes |
/** * {@inheritDoc} */ public void validate() throws InvalidPropertyException { if (ra == null) throw new InvalidPropertyException(); }
Example #13
Source File: CustomMdbContainerTest.java From tomee with Apache License 2.0 | 4 votes |
public void validate() throws InvalidPropertyException { }
Example #14
Source File: SampleActivationSpec.java From tomee with Apache License 2.0 | 4 votes |
@Override public void validate() throws InvalidPropertyException { }
Example #15
Source File: NoMessageDeliveryTest.java From tomee with Apache License 2.0 | 4 votes |
public void validate() throws InvalidPropertyException { }
Example #16
Source File: FakeActivationSpec.java From wildfly-camel with Apache License 2.0 | 4 votes |
@Override public void validate() throws InvalidPropertyException { }
Example #17
Source File: JobExecutionHandlerActivationSpec.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public void validate() throws InvalidPropertyException { // nothing to do (the endpoint has no activation properties) }
Example #18
Source File: SampleActivationSpec.java From tomee with Apache License 2.0 | 4 votes |
@Override public void validate() throws InvalidPropertyException { }
Example #19
Source File: SampleActivationSpec.java From tomee with Apache License 2.0 | 4 votes |
@Override public void validate() throws InvalidPropertyException { }
Example #20
Source File: SampleActivationSpec.java From tomee with Apache License 2.0 | 4 votes |
@Override public void validate() throws InvalidPropertyException { }
Example #21
Source File: StubActivationSpec.java From spring-analysis-note with MIT License | 4 votes |
@Override public void validate() throws InvalidPropertyException { }
Example #22
Source File: ActiveMQActivationsSpecTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
@Test(expected = InvalidPropertyException.class) public void subscriptionDurableButNoName() throws InvalidPropertyException { ActiveMQActivationValidationUtils.validate("", "", true, "subscriptionName"); }
Example #23
Source File: ActiveMQActivationsSpecTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
@Test(expected = InvalidPropertyException.class) public void emptyDestinationType() throws InvalidPropertyException { ActiveMQActivationValidationUtils.validate("destinationName", "", false, "subscriptionName"); }
Example #24
Source File: ActiveMQActivationsSpecTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
public void nullDestinationType() throws InvalidPropertyException { ActiveMQActivationValidationUtils.validate("destinationName", null, false, "subscriptionName"); }
Example #25
Source File: ActiveMQActivationsSpecTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
@Test(expected = InvalidPropertyException.class) public void emptyDestinationName() throws InvalidPropertyException { ActiveMQActivationValidationUtils.validate(null, "destinationType", false, "subscriptionName"); }
Example #26
Source File: ActiveMQActivationsSpecTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
@Test(expected = InvalidPropertyException.class) public void nullDestinationName() throws InvalidPropertyException { ActiveMQActivationValidationUtils.validate(null, "destinationType", false, "subscriptionName"); }
Example #27
Source File: StubActivationSpec.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public void validate() throws InvalidPropertyException { }
Example #28
Source File: StubActivationSpec.java From java-technology-stack with MIT License | 4 votes |
@Override public void validate() throws InvalidPropertyException { }
Example #29
Source File: MDBActivationSpec.java From cxf with Apache License 2.0 | 2 votes |
/** * TODO implement validation */ public void validate() throws InvalidPropertyException { }