[jboss-cvs] JBossAS SVN: r59589 - trunk/testsuite/src/main/org/jboss/test/profileservice/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 12 02:39:37 EST 2007


Author: scott.stark at jboss.org
Date: 2007-01-12 02:39:35 -0500 (Fri, 12 Jan 2007)
New Revision: 59589

Added:
   trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
Log:
Start of profile service tests

Added: trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2007-01-12 07:39:32 UTC (rev 59588)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2007-01-12 07:39:35 UTC (rev 59589)
@@ -0,0 +1,80 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.test.profileservice.test;
+
+import java.util.Collection;
+import java.util.Set;
+
+import javax.naming.InitialContext;
+
+import org.jboss.deployers.spi.management.DeploymentTemplateInfo;
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.profileservice.spi.Profile.DeploymentPhase;
+import org.jboss.test.JBossTestCase;
+
+/** Test of using ProfileService
+
+ @author Scott.Stark at jboss.org
+ @version $Revision: 58115 $
+ */
+public class ProfileServiceUnitTestCase extends JBossTestCase
+{
+   public ProfileServiceUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   /** Basic test of accessing the ProfileService and checking the
+    * available profile keys.
+    */
+   public void testProfileKeys() throws Exception
+   {
+      InitialContext ctx = super.getInitialContext();
+      ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
+      Collection<ProfileKey> keys = ps.getProfileKeys();
+      log.info("getProfileKeys: "+keys);
+      ProfileKey defaultKey = new ProfileKey("default");
+      assertTrue("keys contains default", keys.contains(defaultKey));
+   }
+
+   /**
+    * Test adding a new hsql DataSource deployment
+    * @throws Exception
+    */
+   public void testAddDataSource() throws Exception
+   {
+      InitialContext ctx = super.getInitialContext();
+      ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
+      ProfileKey defaultKey = new ProfileKey("default");
+      ManagementView mgtView = ps.getViewManager();
+      log.info("Templates: "+mgtView.getTemplateNames());
+      DeploymentTemplateInfo dsInfo = mgtView.getTemplate("DsXmlDataSourceTemplate");
+      Set<ManagedProperty> props = dsInfo.getProperties();
+      log.info("ManagedPropertys: "+props);
+
+      mgtView.applyTemplate(defaultKey, DeploymentPhase.APPLICATION,
+            "testAddDataSource", dsInfo);
+   }
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id,Revision
Name: svn:eol-style
   + native




More information about the jboss-cvs-commits mailing list