[jboss-cvs] JBossAS SVN: r82704 - in projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530: unit and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jan 8 10:37:09 EST 2009
Author: ALRubinger
Date: 2009-01-08 10:37:09 -0500 (Thu, 08 Jan 2009)
New Revision: 82704
Added:
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/LifecycleEventRegisteringServiceBase.java
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/LifecycleEventReporterRemoteBusiness.java
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/LifecycleReporterBean.java
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/unit/ServiceLifecycleCallbackOrderTestCase.java
Removed:
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/StartLifecycleRegisteringServiceBase.java
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/StartLifecycleReporterBean.java
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/StartLifecycleReporterRemoteBusiness.java
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/unit/ServiceStartOrderTestCase.java
Modified:
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/LifecycleManagement.java
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/Service1HasADependency.java
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/Service2IsADependency.java
Log:
[EJBTHREE-1530] Enhance the tests to cover start()/create()
Copied: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/LifecycleEventRegisteringServiceBase.java (from rev 82658, projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/StartLifecycleRegisteringServiceBase.java)
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/LifecycleEventRegisteringServiceBase.java (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/LifecycleEventRegisteringServiceBase.java 2009-01-08 15:37:09 UTC (rev 82704)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.ejbthree1530;
+
+import org.jboss.logging.Logger;
+
+/**
+ * LifecycleEventRegisteringServiceBase
+ *
+ * A base for a @Service that registers lifecycle events
+ * with a reporter
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public abstract class LifecycleEventRegisteringServiceBase implements LifecycleManagement
+{
+
+ // ----------------------------------------------------------------||
+ // Class Members --------------------------------------------------||
+ // ----------------------------------------------------------------||
+
+ private static final Logger log = Logger.getLogger(LifecycleEventRegisteringServiceBase.class);
+
+ // ----------------------------------------------------------------||
+ // Required Implementations ---------------------------------------||
+ // ----------------------------------------------------------------||
+
+ public void start() throws Exception
+ {
+ // Log and register
+ String objectName = this.getObjectName();
+ log.info("START: " + objectName);
+ LifecycleReporterBean.STARTED_SERVICE_NAMES.add(objectName);
+ }
+
+ public void create() throws Exception
+ {
+ // Log and register
+ String objectName = this.getObjectName();
+ log.info("CREATE: " + objectName);
+ LifecycleReporterBean.CREATED_SERVICE_NAMES.add(objectName);
+ }
+
+ // ----------------------------------------------------------------||
+ // Contracts ------------------------------------------------------||
+ // ----------------------------------------------------------------||
+
+ /**
+ * Returns the ObjectName (String form) for this service
+ */
+ public abstract String getObjectName();
+
+}
Property changes on: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/LifecycleEventRegisteringServiceBase.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/LifecycleEventReporterRemoteBusiness.java (from rev 82658, projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/StartLifecycleReporterRemoteBusiness.java)
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/LifecycleEventReporterRemoteBusiness.java (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/LifecycleEventReporterRemoteBusiness.java 2009-01-08 15:37:09 UTC (rev 82704)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.ejbthree1530;
+
+import java.util.List;
+
+/**
+ * StartLifecycleReporterRemoteBusiness
+ *
+ * EJB 3.x Remote Business interface for a reporter
+ * of the start() lifecycle events for @Services deployed
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface LifecycleEventReporterRemoteBusiness
+{
+ // ----------------------------------------------------------------||
+ // Contracts ------------------------------------------------------||
+ // ----------------------------------------------------------------||
+
+ /**
+ * Obtains a list of the names (ObjectName) of services started, in order
+ */
+ List<String> getServicesStarted();
+
+ /**
+ * Obtains a list of the names (ObjectName) of services started, in order
+ */
+ List<String> getServicesCreated();
+}
Property changes on: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/LifecycleEventReporterRemoteBusiness.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/LifecycleManagement.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/LifecycleManagement.java 2009-01-08 15:34:08 UTC (rev 82703)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/LifecycleManagement.java 2009-01-08 15:37:09 UTC (rev 82704)
@@ -41,5 +41,7 @@
*/
void start() throws Exception;
+
+ void create() throws Exception;
}
Copied: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/LifecycleReporterBean.java (from rev 82658, projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/StartLifecycleReporterBean.java)
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/LifecycleReporterBean.java (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/LifecycleReporterBean.java 2009-01-08 15:37:09 UTC (rev 82704)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.ejbthree1530;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+/**
+ * LifecycleReporterBean
+ *
+ * Reports order in which lifecycle events of @Services
+ * are registered
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Remote(LifecycleEventReporterRemoteBusiness.class)
+public class LifecycleReporterBean implements LifecycleEventReporterRemoteBusiness
+{
+ // ----------------------------------------------------------------||
+ // Class Members --------------------------------------------------||
+ // ----------------------------------------------------------------||
+
+ /**
+ * Holds the name of each service as it reports it's been created, in order
+ */
+ public static List<String> CREATED_SERVICE_NAMES = new ArrayList<String>();
+
+ /**
+ * Holds the name of each service as it reports it's been started, in order
+ */
+ public static List<String> STARTED_SERVICE_NAMES = new ArrayList<String>();
+
+ // ----------------------------------------------------------------||
+ // Required Implementations ---------------------------------------||
+ // ----------------------------------------------------------------||
+
+ public List<String> getServicesCreated()
+ {
+ return Collections.unmodifiableList(CREATED_SERVICE_NAMES);
+ }
+
+ public List<String> getServicesStarted()
+ {
+ return Collections.unmodifiableList(STARTED_SERVICE_NAMES);
+ }
+
+}
Property changes on: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/LifecycleReporterBean.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/Service1HasADependency.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/Service1HasADependency.java 2009-01-08 15:34:08 UTC (rev 82703)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/Service1HasADependency.java 2009-01-08 15:37:09 UTC (rev 82704)
@@ -39,7 +39,7 @@
@Management(LifecycleManagement.class)
@Depends(Service2IsADependency.OBJECT_NAME)
// < Defines the dependency, and hence order of startup
-public class Service1HasADependency extends StartLifecycleRegisteringServiceBase
+public class Service1HasADependency extends LifecycleEventRegisteringServiceBase
implements
LifecycleManagement
{
Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/Service2IsADependency.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/Service2IsADependency.java 2009-01-08 15:34:08 UTC (rev 82703)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/Service2IsADependency.java 2009-01-08 15:37:09 UTC (rev 82704)
@@ -35,7 +35,7 @@
*/
@Service(objectName = Service2IsADependency.OBJECT_NAME)
@Management(LifecycleManagement.class)
-public class Service2IsADependency extends StartLifecycleRegisteringServiceBase implements LifecycleManagement
+public class Service2IsADependency extends LifecycleEventRegisteringServiceBase implements LifecycleManagement
{
// ----------------------------------------------------------------||
Deleted: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/StartLifecycleRegisteringServiceBase.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/StartLifecycleRegisteringServiceBase.java 2009-01-08 15:34:08 UTC (rev 82703)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/StartLifecycleRegisteringServiceBase.java 2009-01-08 15:37:09 UTC (rev 82704)
@@ -1,65 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.test.ejbthree1530;
-
-import org.jboss.logging.Logger;
-
-/**
- * LifecycleServiceBase
- *
- * A base for a @Service that registers start() of its lifecycle
- * with a reporter
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public abstract class StartLifecycleRegisteringServiceBase implements LifecycleManagement
-{
-
- // ----------------------------------------------------------------||
- // Class Members --------------------------------------------------||
- // ----------------------------------------------------------------||
-
- private static final Logger log = Logger.getLogger(StartLifecycleRegisteringServiceBase.class);
-
- // ----------------------------------------------------------------||
- // Required Implementations ---------------------------------------||
- // ----------------------------------------------------------------||
-
- public void start() throws Exception
- {
- // Log and register
- String objectName = this.getObjectName();
- log.info("START: " + objectName);
- StartLifecycleReporterBean.CREATED_SERVICE_NAMES.add(objectName);
- }
-
- // ----------------------------------------------------------------||
- // Contracts ------------------------------------------------------||
- // ----------------------------------------------------------------||
-
- /**
- * Returns the ObjectName (String form) for this service
- */
- public abstract String getObjectName();
-
-}
Deleted: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/StartLifecycleReporterBean.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/StartLifecycleReporterBean.java 2009-01-08 15:34:08 UTC (rev 82703)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/StartLifecycleReporterBean.java 2009-01-08 15:37:09 UTC (rev 82704)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.test.ejbthree1530;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.ejb.Remote;
-import javax.ejb.Stateless;
-
-/**
- * StartLifecycleReporterBean
- *
- * Reports order in which start() lifecycle of @Services
- * are registered
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
- at Stateless
- at Remote(StartLifecycleReporterRemoteBusiness.class)
-public class StartLifecycleReporterBean implements StartLifecycleReporterRemoteBusiness
-{
- // ----------------------------------------------------------------||
- // Class Members --------------------------------------------------||
- // ----------------------------------------------------------------||
-
- /**
- * Holds the name of each service as it reports it's been started, in order
- */
- public static List<String> CREATED_SERVICE_NAMES = new ArrayList<String>();
-
- // ----------------------------------------------------------------||
- // Required Implementations ---------------------------------------||
- // ----------------------------------------------------------------||
-
- public List<String> getServicesStarted()
- {
- return Collections.unmodifiableList(CREATED_SERVICE_NAMES);
- }
-
-}
Deleted: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/StartLifecycleReporterRemoteBusiness.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/StartLifecycleReporterRemoteBusiness.java 2009-01-08 15:34:08 UTC (rev 82703)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/StartLifecycleReporterRemoteBusiness.java 2009-01-08 15:37:09 UTC (rev 82704)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.test.ejbthree1530;
-
-import java.util.List;
-
-/**
- * StartLifecycleReporterRemoteBusiness
- *
- * EJB 3.x Remote Business interface for a reporter
- * of the start() lifecycle events for @Services deployed
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public interface StartLifecycleReporterRemoteBusiness
-{
- // ----------------------------------------------------------------||
- // Contracts ------------------------------------------------------||
- // ----------------------------------------------------------------||
-
- /**
- * Obtains a list of the names (ObjectName) of services started, in order
- */
- List<String> getServicesStarted();
-}
Copied: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/unit/ServiceLifecycleCallbackOrderTestCase.java (from rev 82658, projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/unit/ServiceStartOrderTestCase.java)
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/unit/ServiceLifecycleCallbackOrderTestCase.java (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/unit/ServiceLifecycleCallbackOrderTestCase.java 2009-01-08 15:37:09 UTC (rev 82704)
@@ -0,0 +1,145 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.ejbthree1530.unit;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.naming.Context;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree1530.LifecycleEventReporterRemoteBusiness;
+import org.jboss.ejb3.test.ejbthree1530.LifecycleReporterBean;
+import org.jboss.ejb3.test.ejbthree1530.Service1HasADependency;
+import org.jboss.ejb3.test.ejbthree1530.Service2IsADependency;
+import org.jboss.logging.Logger;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * ServiceStartOrderTestCase
+ *
+ * Test Cases to ensure @Service lifecycle events
+ * are called in proper order
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class ServiceLifecycleCallbackOrderTestCase extends JBossTestCase
+{
+
+ // --------------------------------------------------------------------------------||
+ // Class Members ------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ private static final Logger log = Logger.getLogger(ServiceLifecycleCallbackOrderTestCase.class);
+
+ // --------------------------------------------------------------------------------||
+ // Constructor --------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ public ServiceLifecycleCallbackOrderTestCase(String name)
+ {
+ super(name);
+ }
+
+ // --------------------------------------------------------------------------------||
+ // Suite --------------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ public static Test suite() throws Exception
+ {
+ /*
+ * Get the deploy setup
+ */
+ return getDeploySetup(ServiceLifecycleCallbackOrderTestCase.class, "ejbthree1530.jar");
+ }
+
+ // --------------------------------------------------------------------------------||
+ // Tests --------------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ /**
+ * Tests that the dependent service is started before the service declaring
+ * the dependency
+ */
+ public void testDependentServiceStartedFirst() throws Throwable
+ {
+ // Test
+ this.executeTestAsExpected(this.getLifecycleReporter().getServicesStarted());
+ }
+
+ /**
+ * Tests that the dependent service is created before the service declaring
+ * the dependency
+ */
+ public void testDependentServiceCreatedFirst() throws Throwable
+ {
+ // Test
+ this.executeTestAsExpected(this.getLifecycleReporter().getServicesCreated());
+ }
+
+ // --------------------------------------------------------------------------------||
+ // Internal Helper Methods --------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ /**
+ * Obtains the Lifecycle Reporter SLSB
+ */
+ private LifecycleEventReporterRemoteBusiness getLifecycleReporter() throws Throwable
+ {
+ // Lookup the reporter
+ Context context = this.getInitialContext();
+ Object obj = context.lookup(LifecycleReporterBean.class.getSimpleName() + "/remote");
+ LifecycleEventReporterRemoteBusiness reporter = (LifecycleEventReporterRemoteBusiness) obj;
+ return reporter;
+ }
+
+ /**
+ * Tests that the actual lifecycle events took place
+ * in the order expected, with the correct number of entries
+ *
+ * @param actual
+ * @throws Throwable
+ */
+ private void executeTestAsExpected(List<String> actual) throws Throwable
+ {
+ // Initialize the expected order
+ List<String> lifecycleEventExpectedOrder = new ArrayList<String>();
+ lifecycleEventExpectedOrder.add(Service2IsADependency.OBJECT_NAME);
+ lifecycleEventExpectedOrder.add(Service1HasADependency.OBJECT_NAME);
+
+ // Log
+ log.info("Lifecycle Events Expected Order: " + lifecycleEventExpectedOrder);
+ log.info("Lifecycle Events Actual Order: " + actual);
+
+ // Test all is as expected
+ assertEquals("Wrong number of services lifecycle events reported as invoked", lifecycleEventExpectedOrder.size(),
+ actual.size());
+ for (int i = 0; i < actual.size(); i++)
+ {
+ assertEquals("Service lifecycle event order did not match expected", lifecycleEventExpectedOrder.get(i), actual
+ .get(i));
+ }
+ }
+
+}
Property changes on: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/unit/ServiceLifecycleCallbackOrderTestCase.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/unit/ServiceStartOrderTestCase.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/unit/ServiceStartOrderTestCase.java 2009-01-08 15:34:08 UTC (rev 82703)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1530/unit/ServiceStartOrderTestCase.java 2009-01-08 15:37:09 UTC (rev 82704)
@@ -1,114 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.test.ejbthree1530.unit;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.naming.Context;
-
-import junit.framework.Test;
-
-import org.jboss.ejb3.test.ejbthree1530.Service2IsADependency;
-import org.jboss.ejb3.test.ejbthree1530.Service1HasADependency;
-import org.jboss.ejb3.test.ejbthree1530.StartLifecycleReporterBean;
-import org.jboss.ejb3.test.ejbthree1530.StartLifecycleReporterRemoteBusiness;
-import org.jboss.logging.Logger;
-import org.jboss.test.JBossTestCase;
-
-/**
- * ServiceStartOrderTestCase
- *
- * Test Cases to ensure @Service lifecycle start()
- * is called in proper order
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public class ServiceStartOrderTestCase extends JBossTestCase
-{
-
- // --------------------------------------------------------------------------------||
- // Class Members ------------------------------------------------------------------||
- // --------------------------------------------------------------------------------||
-
- private static final Logger log = Logger.getLogger(ServiceStartOrderTestCase.class);
-
- // --------------------------------------------------------------------------------||
- // Constructor --------------------------------------------------------------------||
- // --------------------------------------------------------------------------------||
-
- public ServiceStartOrderTestCase(String name)
- {
- super(name);
- }
-
- // --------------------------------------------------------------------------------||
- // Suite --------------------------------------------------------------------------||
- // --------------------------------------------------------------------------------||
-
- public static Test suite() throws Exception
- {
- /*
- * Get the deploy setup
- */
- return getDeploySetup(ServiceStartOrderTestCase.class, "ejbthree1530.jar");
- }
-
- // --------------------------------------------------------------------------------||
- // Tests --------------------------------------------------------------------------||
- // --------------------------------------------------------------------------------||
-
- /**
- * Tests that the dependent service is started before the service declaring
- * the dependency
- */
- public void testDependentServiceStartedFirst() throws Throwable
- {
-
- // Lookup the reporter
- Context context = this.getInitialContext();
- Object obj = context.lookup(StartLifecycleReporterBean.class.getSimpleName() + "/remote");
- StartLifecycleReporterRemoteBusiness reporter = (StartLifecycleReporterRemoteBusiness) obj;
-
- // Initialize the expected start order
- List<String> servicesStartedAsExpected = new ArrayList<String>();
- servicesStartedAsExpected.add(Service2IsADependency.OBJECT_NAME);
- servicesStartedAsExpected.add(Service1HasADependency.OBJECT_NAME);
- log.info("Services Start Expected Order: " + servicesStartedAsExpected);
-
- // Get the actual start order
- List<String> servicesStarted = reporter.getServicesStarted();
- log.info("Services Start Actual Order: " + servicesStarted);
-
- // Test all is as expected
- assertEquals("Wrong number of services reported as started", servicesStartedAsExpected.size(), servicesStarted
- .size());
- for (int i = 0; i < servicesStarted.size(); i++)
- {
- assertEquals("Service start order did not match expected", servicesStartedAsExpected.get(i), servicesStarted
- .get(i));
- }
-
- }
-
-}
More information about the jboss-cvs-commits
mailing list