Package org.jboss.as.ejb3.component.description

Examples of org.jboss.as.ejb3.component.description.EjbJarDescriptionMergingUtil


    public void testEveryMorningFiveFifteen() {
        ScheduleExpression everyMorningFiveFifteen = this.getTimezoneSpecificScheduleExpression();
        everyMorningFiveFifteen.minute(15);
        everyMorningFiveFifteen.hour(5);

        CalendarBasedTimeout calendarTimeout = new CalendarBasedTimeout(everyMorningFiveFifteen);

        Calendar firstTimeout = calendarTimeout.getFirstTimeout();

        Assert.assertNotNull("first timeout is null", firstTimeout);
        Date firstTimeoutDate = firstTimeout.getTime();
        int minute = firstTimeout.get(Calendar.MINUTE);
        int second = firstTimeout.get(Calendar.SECOND);
        int hour = firstTimeout.get(Calendar.HOUR_OF_DAY);
        int amOrPm = firstTimeout.get(Calendar.AM_PM);
        Assert.assertEquals("Unexpected second in first timeout " + firstTimeoutDate, 0, second);
        Assert.assertEquals("Unexpected minute in first timeout " + firstTimeoutDate, 15, minute);
        Assert.assertEquals("Unexpected hour in first timeout " + firstTimeoutDate, 5, hour);
        Assert.assertEquals("Unexpected AM/PM in first timeout ", Calendar.AM, amOrPm);

        Calendar previousTimeout = firstTimeout;
        for (int i = 1; i <= 370; i++) {
            Calendar nextTimeout = calendarTimeout.getNextTimeout(previousTimeout);

            Assert.assertNotNull("Next timeout is null", nextTimeout);
            Assert.assertNotNull("Next timeout is *before* the current time", nextTimeout.after(previousTimeout));
            logger.debug("First timeout was: " + firstTimeout.getTime() + " Previous timeout was: "
                    + previousTimeout.getTime() + " Next timeout is " + nextTimeout.getTime());
View Full Code Here


        ScheduleExpression everyWeekDayThreeFifteen = this.getTimezoneSpecificScheduleExpression();
        everyWeekDayThreeFifteen.minute(15);
        everyWeekDayThreeFifteen.hour(8);
        everyWeekDayThreeFifteen.dayOfWeek("Mon-Fri");

        CalendarBasedTimeout calendarTimeout = new CalendarBasedTimeout(everyWeekDayThreeFifteen);

        Calendar firstTimeout = calendarTimeout.getFirstTimeout();
        Assert.assertNotNull("first timeout is null", firstTimeout);
        Date firstTimeoutDate = firstTimeout.getTime();
        int minute = firstTimeout.get(Calendar.MINUTE);
        int second = firstTimeout.get(Calendar.SECOND);
        int hour = firstTimeout.get(Calendar.HOUR_OF_DAY);
        int amOrPm = firstTimeout.get(Calendar.AM_PM);
        int dayOfWeek = firstTimeout.get(Calendar.DAY_OF_WEEK);
        Assert.assertEquals("Unexpected second in first timeout " + firstTimeoutDate, 0, second);
        Assert.assertEquals("Unexpected minute in first timeout " + firstTimeoutDate, 15, minute);
        Assert.assertEquals("Unexpected hour in first timeout " + firstTimeoutDate, 8, hour);
        Assert.assertEquals("Unexpected AM/PM in first timeout ", Calendar.AM, amOrPm);
        Assert.assertTrue("Unexpected day of week: " + dayOfWeek + " in first timeout", this.isWeekDay(firstTimeout));

        Calendar previousTimeout = firstTimeout;
        for (int i = 1; i <= 180; i++) {
            Calendar nextTimeout = calendarTimeout.getNextTimeout(previousTimeout);

            Assert.assertNotNull("Next timeout is null", nextTimeout);
            Assert.assertNotNull("Next timeout is *before* the current time", nextTimeout.after(previousTimeout));

            Date nextTimeoutDate = nextTimeout.getTime();
View Full Code Here

        ScheduleExpression everyMonWedFriTwelveThirtyNoon = this.getTimezoneSpecificScheduleExpression();
        everyMonWedFriTwelveThirtyNoon.hour(12);
        everyMonWedFriTwelveThirtyNoon.second("30");
        everyMonWedFriTwelveThirtyNoon.dayOfWeek("Mon,Wed,Fri");

        CalendarBasedTimeout calendarTimeout = new CalendarBasedTimeout(everyMonWedFriTwelveThirtyNoon);

        Calendar firstTimeout = calendarTimeout.getFirstTimeout();
        Assert.assertNotNull("first timeout is null", firstTimeout);
        Date firstTimeoutDate = firstTimeout.getTime();
        int minute = firstTimeout.get(Calendar.MINUTE);
        int second = firstTimeout.get(Calendar.SECOND);
        int hour = firstTimeout.get(Calendar.HOUR_OF_DAY);
        int amOrPm = firstTimeout.get(Calendar.AM_PM);
        int dayOfWeek = firstTimeout.get(Calendar.DAY_OF_WEEK);
        Assert.assertEquals("Unexpected second in first timeout " + firstTimeoutDate, 30, second);
        Assert.assertEquals("Unexpected minute in first timeout " + firstTimeoutDate, 0, minute);
        Assert.assertEquals("Unexpected hour in first timeout " + firstTimeoutDate, 12, hour);
        Assert.assertEquals("Unexpected AM/PM in first timeout ", Calendar.PM, amOrPm);
        List<Integer> validDays = new ArrayList<Integer>();
        validDays.add(Calendar.MONDAY);
        validDays.add(Calendar.WEDNESDAY);
        validDays.add(Calendar.FRIDAY);
        Assert.assertTrue("Unexpected day of week: " + dayOfWeek + " in first timeout", validDays.contains(dayOfWeek));

        Calendar previousTimeout = firstTimeout;
        for (int i = 1; i <= 180; i++) {
            Calendar nextTimeout = calendarTimeout.getNextTimeout(previousTimeout);

            Assert.assertNotNull("Next timeout is null", nextTimeout);
            Assert.assertNotNull("Next timeout is *before* the current time", nextTimeout.after(previousTimeout));

            Date nextTimeoutDate = nextTimeout.getTime();
View Full Code Here

        every31st9_30_15_AM.dayOfMonth(31);
        every31st9_30_15_AM.hour(9);
        every31st9_30_15_AM.minute("30");
        every31st9_30_15_AM.second(15);

        CalendarBasedTimeout calendarTimeout = new CalendarBasedTimeout(every31st9_30_15_AM);

        Calendar firstTimeout = calendarTimeout.getFirstTimeout();
        Assert.assertNotNull("first timeout is null", firstTimeout);
        Date firstTimeoutDate = firstTimeout.getTime();
        int minute = firstTimeout.get(Calendar.MINUTE);
        int second = firstTimeout.get(Calendar.SECOND);
        int hour = firstTimeout.get(Calendar.HOUR_OF_DAY);
        int amOrPm = firstTimeout.get(Calendar.AM_PM);
        int dayOfMonth = firstTimeout.get(Calendar.DAY_OF_MONTH);
        Assert.assertEquals("Unexpected second in first timeout " + firstTimeoutDate, 15, second);
        Assert.assertEquals("Unexpected minute in first timeout " + firstTimeoutDate, 30, minute);
        Assert.assertEquals("Unexpected hour in first timeout " + firstTimeoutDate, 9, hour);
        Assert.assertEquals("Unexpected AM/PM in first timeout ", Calendar.AM, amOrPm);
        Assert.assertEquals("Unexpected day of month in first timeout ", 31, dayOfMonth);

        Calendar previousTimeout = firstTimeout;
        for (int i = 1; i <= 180; i++) {
            Calendar nextTimeout = calendarTimeout.getNextTimeout(previousTimeout);

            Assert.assertNotNull("Next timeout is null", nextTimeout);
            Assert.assertNotNull("Next timeout is *before* the current time", nextTimeout.after(previousTimeout));

            Date nextTimeoutDate = nextTimeout.getTime();
View Full Code Here

    public void testRun29thOfFeb() {
        ScheduleExpression everyLeapYearOn29thFeb = this.getTimezoneSpecificScheduleExpression();
        everyLeapYearOn29thFeb.dayOfMonth(29);
        everyLeapYearOn29thFeb.month("fEb");

        CalendarBasedTimeout calendarTimeout = new CalendarBasedTimeout(everyLeapYearOn29thFeb);

        Calendar firstTimeout = calendarTimeout.getFirstTimeout();
        Assert.assertNotNull("first timeout is null", firstTimeout);
        Date firstTimeoutDate = firstTimeout.getTime();
        int minute = firstTimeout.get(Calendar.MINUTE);
        int second = firstTimeout.get(Calendar.SECOND);
        int hour = firstTimeout.get(Calendar.HOUR_OF_DAY);
        int amOrPm = firstTimeout.get(Calendar.AM_PM);
        int dayOfMonth = firstTimeout.get(Calendar.DAY_OF_MONTH);
        int year = firstTimeout.get(Calendar.YEAR);
        int month = firstTimeout.get(Calendar.MONTH);

        Assert.assertEquals("Unexpected second in first timeout " + firstTimeoutDate, 0, second);
        Assert.assertEquals("Unexpected minute in first timeout " + firstTimeoutDate, 0, minute);
        Assert.assertEquals("Unexpected hour in first timeout " + firstTimeout, 0, hour);
        Assert.assertEquals("Unexpected AM/PM in first timeout ", Calendar.AM, amOrPm);
        Assert.assertEquals("Unexpected day of month in first timeout ", 29, dayOfMonth);
        Assert.assertEquals("Unexpected month in first timeout ", Calendar.FEBRUARY, month);
        Assert.assertTrue("Year: " + year + " is not a leap year", this.isLeapYear(firstTimeout));

        Calendar previousTimeout = firstTimeout;
        for (int i = 1; i <= 2; i++) {
            Calendar nextTimeout = calendarTimeout.getNextTimeout(previousTimeout);

            Assert.assertNotNull("Next timeout is null", nextTimeout);
            Assert.assertNotNull("Next timeout is *before* the current time", nextTimeout.after(previousTimeout));

            Date nextTimeoutDate = nextTimeout.getTime();
View Full Code Here

        every0_15_30_Sec_At_9_30_PM.month("Nov-Feb");
        every0_15_30_Sec_At_9_30_PM.second("0,15,30");
        every0_15_30_Sec_At_9_30_PM.minute(30);
        every0_15_30_Sec_At_9_30_PM.hour("21");

        CalendarBasedTimeout calendarTimeout = new CalendarBasedTimeout(every0_15_30_Sec_At_9_30_PM);
        Calendar firstTimeout = calendarTimeout.getFirstTimeout();
        Assert.assertNotNull("first timeout is null", firstTimeout);
        Date firstTimeoutDate = firstTimeout.getTime();
        logger.debug("First timeout is " + firstTimeoutDate);

        int minute = firstTimeout.get(Calendar.MINUTE);
        int second = firstTimeout.get(Calendar.SECOND);
        int hour = firstTimeout.get(Calendar.HOUR_OF_DAY);
        int amOrPm = firstTimeout.get(Calendar.AM_PM);
        int dayOfMonth = firstTimeout.get(Calendar.DAY_OF_MONTH);
        int month = firstTimeout.get(Calendar.MONTH);

        Assert.assertEquals("Unexpected second in first timeout " + firstTimeoutDate, 0, second);
        Assert.assertEquals("Unexpected minute in first timeout " + firstTimeoutDate, 30, minute);
        Assert.assertEquals("Unexpected hour in first timeout " + firstTimeoutDate, 21, hour);
        Assert.assertEquals("Unexpected AM/PM in first timeout ", Calendar.PM, amOrPm);
        Assert.assertEquals("Unexpected day of month in first timeout ", 31, dayOfMonth);
        List<Integer> validMonths = new ArrayList<Integer>();
        validMonths.add(Calendar.NOVEMBER);
        validMonths.add(Calendar.DECEMBER);
        validMonths.add(Calendar.JANUARY);
        validMonths.add(Calendar.FEBRUARY);
        Assert.assertTrue("Unexpected month: " + month, validMonths.contains(month));

        Calendar nextTimeout = calendarTimeout.getNextTimeout(firstTimeout);
        long diff = nextTimeout.getTimeInMillis() - firstTimeout.getTimeInMillis();
        Assert.assertEquals("Unexpected next timeout " + nextTimeout.getTime(), 15 * 1000, diff);

        Calendar currentSystemDate = new GregorianCalendar();
        Calendar nextTimeoutFromNow = calendarTimeout.getNextTimeout(currentSystemDate);
        logger.debug("Next timeout from now is " + nextTimeoutFromNow.getTime());
        int nextMinute = nextTimeoutFromNow.get(Calendar.MINUTE);
        int nextSecond = nextTimeoutFromNow.get(Calendar.SECOND);
        int nextHour = nextTimeoutFromNow.get(Calendar.HOUR_OF_DAY);
        int nextAmOrPM = nextTimeoutFromNow.get(Calendar.AM_PM);
View Full Code Here

        ScheduleExpression every10Secs = this.getTimezoneSpecificScheduleExpression();
        every10Secs.second("*/10");
        every10Secs.minute("*");
        every10Secs.hour("*");

        CalendarBasedTimeout calendarTimeout = new CalendarBasedTimeout(every10Secs);
        Calendar firstTimeout = calendarTimeout.getFirstTimeout();

        int firstTimeoutSecond = firstTimeout.get(Calendar.SECOND);
        Assert.assertTrue("Unexpected second " + firstTimeoutSecond + " in first timeout " + firstTimeout,
                firstTimeoutSecond % 10 == 0);

        Calendar previousTimeout = firstTimeout;
        for (int i = 0; i < 5; i++) {
            Calendar nextTimeout = calendarTimeout.getNextTimeout(previousTimeout);
            int nextTimeoutSecond = nextTimeout.get(Calendar.SECOND);
            Assert.assertTrue("Unexpected second " + nextTimeoutSecond + " in next timeout " + nextTimeout,
                    nextTimeoutSecond % 10 == 0);

            previousTimeout = nextTimeout;
View Full Code Here

        for (String invalidRange : invalidRangeValues) {
            boolean accepts = RangeValue.accepts(invalidRange);
            Assert.assertFalse("Range value accepted an invalid value: " + invalidRange, accepts);

            try {
                RangeValue invalidRangeValue = new RangeValue(invalidRange);
                Assert.fail("Range value did *not* throw IllegalArgumentException for an invalid range: " + invalidRange);
            } catch (IllegalArgumentException iae) {
                // expected
            }
        }
View Full Code Here

        String[] validRanges =
                {"1-8", "-7--1", "7--1", "1st Fri-1st Mon"};
        for (String validRange : validRanges) {
            boolean accepts = RangeValue.accepts(validRange);
            Assert.assertTrue("Valid range value wasn't accepted: " + validRange, accepts);
            RangeValue validRangeValue = new RangeValue(validRange);
        }
    }
View Full Code Here

        if (exceptionClassName == null || exceptionClassName.isEmpty()) {
            throw EjbMessages.MESSAGES.stringParamCannotBeNullOrEmpty("Exception class name");
        }
        //TODO: Is this a good idea? ApplicationException's equals/hashCode
        //will not work the way that would be expected
        ApplicationExceptionDetails appException = new ApplicationExceptionDetails(exceptionClassName, inherited, rollback);
        // add it to the map
        this.applicationExceptions.put(exceptionClassName, appException);
    }
View Full Code Here

TOP

Related Classes of org.jboss.as.ejb3.component.description.EjbJarDescriptionMergingUtil

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.