[jboss-cvs] system2/src/tests/org/jboss/test/profileservice/simple1 ...

Scott Stark scott.stark at jboss.com
Fri Jul 14 00:27:24 EDT 2006


  User: starksm 
  Date: 06/07/14 00:27:24

  Added:       src/tests/org/jboss/test/profileservice/simple1        
                        ProfileServiceImpl.java ProfileImpl.java
                        PropertyInfoImpl.java SecurityActions.java
                        ManagementViewImpl.java ProfileImpl2.java
                        ProfileServiceImpl2.java DeploymentImpl.java
  Log:
  Move profileservice tests to the server module
  
  Revision  Changes    Path
  1.1      date: 2006/07/14 04:27:24;  author: starksm;  state: Exp;system2/src/tests/org/jboss/test/profileservice/simple1/ProfileServiceImpl.java
  
  Index: ProfileServiceImpl.java
  ===================================================================
  /*
   * 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.simple1;
  
  import java.io.IOException;
  
  import org.jboss.profileservice.spi.ProfileService;
  import org.jboss.profileservice.spi.ProfileKey;
  import org.jboss.profileservice.spi.Profile;
  import org.jboss.profileservice.spi.NoSuchProfileException;
  import org.jboss.deployers.spi.management.ManagementView;
  
  /**
   * A simple read-only profile service for testing the basic kernel bootstrap
   * and management view usecases.
   * 
   * @author Scott.Stark at jboss.org
   * @version $Revision$
   */
  public class ProfileServiceImpl
     implements ProfileService
  {
     protected Profile defatulImpl;
     private ManagementViewImpl mgtView;
  
     public ProfileServiceImpl() throws IOException
     {
        defatulImpl = new ProfileImpl();
     }
     public String[] getDomains()
     {
        String[] domains = {ProfileKey.DEFAULT};
        return domains;
     }
  
     public ProfileKey[] getProfileKeys()
     {
        ProfileKey[] keys = {new ProfileKey(null)};
        return keys;
     }
  
     /**
      * Always returns the default profile.
      */
     public Profile getProfile(ProfileKey key)
        throws NoSuchProfileException
     {
        return defatulImpl;
     }
  
     public String[] getProfileDeploymentNames(ProfileKey key)
        throws NoSuchProfileException
     {
        String[] names = {"default"};
        return names;
     }
  
     public ManagementView getViewManager()
     {
        return mgtView;
     }
  
     // Admin of profiles @todo could be an option plugin
     public Profile newProfile(ProfileKey key)
     {
        return null;
     }
  
     public void removeProfile(ProfileKey key)
        throws NoSuchProfileException
     {
     }
  }
  
  
  
  1.1      date: 2006/07/14 04:27:24;  author: starksm;  state: Exp;system2/src/tests/org/jboss/test/profileservice/simple1/ProfileImpl.java
  
  Index: ProfileImpl.java
  ===================================================================
  /*
    * 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.simple1;
  
  import java.io.IOException;
  import java.net.URL;
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.HashSet;
  import java.util.Map;
  
  import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
  import org.jboss.beans.metadata.plugins.AbstractDemandMetaData;
  import org.jboss.beans.metadata.plugins.AbstractPropertyMetaData;
  import org.jboss.beans.metadata.spi.BeanMetaData;
  import org.jboss.beans.metadata.spi.DemandMetaData;
  import org.jboss.profileservice.spi.NoSuchDeploymentException;
  import org.jboss.profileservice.spi.Profile;
  import org.jboss.profileservice.spi.DeploymentTemplate;
  import org.jboss.deployers.spi.Deployment;
  
  /**
   * A test profile with a fixed default deployment. The contents of the
   * deployments are expected to be in the 
   * 
   * @author Scott.Stark at jboss.org
   * @version $Revision$
   */
  public class ProfileImpl
     implements Profile
  {
     private HashMap<String, Deployment> deployments;
  
     public ProfileImpl() throws IOException
     {
        deployments = new HashMap<String, Deployment>();
        String deployDir = SecurityActions.getSystemProperty("jbosstest.deploy.dir");
        URL libURL;
        if( deployDir == null )
        {
           // Used codesource + ../lib
           URL classes = getClass().getProtectionDomain().getCodeSource().getLocation();
           libURL = new URL(classes, "../lib/");
        }
        else
        {
           libURL = new URL(deployDir);
        }
  
        DeploymentImpl p0 = new DeploymentImpl();
        p0.setName("CoreServices");
        p0.setRootURL(libURL);
        String[] files = {"p0.jar"};
        p0.setFiles(files);
        /*
        ArrayList<DeploymentBean> beans = new ArrayList<DeploymentBean>();
        // NamingService
        String nsName = "TheNamingService";
        String nsType = "org.jboss.test.profileservice.profiles.p0.beans.NamingService";
        DeploymentBeanImpl<BeanMetaData> ns = new DeploymentBeanImpl<BeanMetaData>(nsName, nsType);
        AbstractBeanMetaData nsMetaData = new AbstractBeanMetaData(nsName, nsType);
        ns.setBeanMetaData(nsMetaData);
        beans.add(ns);
        // JTA
        String txName = "TheTxMgr";
        String txType = "org.jboss.test.profileservice.profiles.p0.beans.TxMgr";
        DeploymentBeanImpl<BeanMetaData> txMgr = new DeploymentBeanImpl<BeanMetaData>(txName, txType);
        AbstractBeanMetaData txMetaData = new AbstractBeanMetaData(txName, txType);
        HashSet<DemandMetaData> txDemands = new HashSet<DemandMetaData>();
        txDemands.add(new AbstractDemandMetaData(nsName));
        txMetaData.setDemands(txDemands);
        txMgr.setBeanMetaData(txMetaData);
        beans.add(txMgr);
        // JCA
        String jcaName = "TheJCAMgr";
        String jcaType = "org.jboss.test.profileservice.profiles.p0.beans.JCAMgr";
        DeploymentBeanImpl<BeanMetaData> jca = new DeploymentBeanImpl<BeanMetaData>(jcaName, jcaType);
        AbstractBeanMetaData jcaMetaData = new AbstractBeanMetaData(jcaName, jcaType);
        HashSet<DemandMetaData> jcaDemands = new HashSet<DemandMetaData>();
        jcaDemands.add(new AbstractDemandMetaData(nsName));
        jcaDemands.add(new AbstractDemandMetaData(txName));
        jcaMetaData.setDemands(jcaDemands);
        jca.setBeanMetaData(jcaMetaData);
        beans.add(jca);
        */
        deployments.put("CoreServices", p0);
     }
  
     public String getVersion()
     {
        return "1.0.0";
     }
  
     public DeploymentTemplate getTemplate(String name)
     {
        return null;
     }
  
     public void addDeployment(Deployment d)
     {
        throw new UnsupportedOperationException("simple1 is read-only");
     }
  
     public void removeDeployment(String name)
     {
        throw new UnsupportedOperationException("simple1 is read-only");
     }
  
     public Deployment[] getDeployments()
     {
        Deployment[] tmp = new Deployment[deployments.size()];
        deployments.values().toArray(tmp);
        return tmp;
     }
  
     public Map<String, Object> getConfig()
     {
        return null;
     }
  
     public Deployment getDeployment(String name)
        throws NoSuchDeploymentException
     {
        Deployment d = deployments.get(name);
        if( d == null )
           throw new NoSuchDeploymentException(name);
        return d;
     }
  }
  
  
  
  1.1      date: 2006/07/14 04:27:24;  author: starksm;  state: Exp;system2/src/tests/org/jboss/test/profileservice/simple1/PropertyInfoImpl.java
  
  Index: PropertyInfoImpl.java
  ===================================================================
  package org.jboss.test.profileservice.simple1;
  
  import org.jboss.profileservice.spi.PropertyInfo;
  import org.jboss.profileservice.spi.OpenType;
  
  import java.util.Set;
  import java.util.Map;
  import java.util.HashMap;
  
  /**
   * @author ccrouch at jboss.org
   * @version $Revision$
   */
  public class PropertyInfoImpl implements PropertyInfo {
  
      private String name;
      private Object value;
      private Map fields;
  
  
      public PropertyInfoImpl(String name, OpenType type) {
          fields = new HashMap();
          this.name = name;
          fields.put("openType", type);
      }
  
      public String getName() {
          return name;
      }
  
      public String getDescription() {
          return (String) fields.get("org.jboss.profileservice.description");
      }
  
      public Set<?> getLegalValues() {
           return (Set<?>) fields.get("legalValues");
      }
  
      public Comparable<?> getMinValue() {
          return null;
      }
  
      public Comparable<?> getMaxValue() {
          return null;
      }
  
      public boolean isValue(Object obj) {
          return false;
      }
  
      public OpenType<?> getOpenType() {
          return (OpenType<?>) fields.get("openType");
      }
  
     public Object getFieldValue(String fieldName)
     {
        return fields.get(fieldName);
     }
  
     public void setFields(String[] fieldNames, Object[] fieldValues)
     {
        if (fieldNames == null || fieldValues == null)
        {
           throw new IllegalArgumentException("Neither fieldNames array nor fieldValues array can be null");
        }
  
        if (fieldNames.length != fieldValues.length)
        {
           throw new IllegalArgumentException("size of fieldNames array must match size of fieldValues array");
        }
  
        for (int i=0; i<fieldNames.length; i++)
        {
           fields.put(fieldNames[i], fieldValues[i]);
        }
     }
  
  
     public Object getValue() {
         return value;
     }
  
      public void setValue(Object value) {
          this.value = value;
      }
  }
  
  
  
  1.1      date: 2006/07/14 04:27:24;  author: starksm;  state: Exp;system2/src/tests/org/jboss/test/profileservice/simple1/SecurityActions.java
  
  Index: SecurityActions.java
  ===================================================================
  /*
   * 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.simple1;
  
  import java.security.PrivilegedAction;
  import java.security.AccessController;
  
  /**
   * Package privileged actions.
   * 
   * @author Scott.Stark at jboss.org
   * @version $Revision$
   */
  class SecurityActions
  {
     static String getSystemProperty(final String name)
     {
        PrivilegedAction<String> action = new PrivilegedAction<String>()
        {
           public String run()
           {
              return System.getProperty(name);
           }
        };
        return AccessController.doPrivileged(action);
     }
  }
  
  
  
  1.1      date: 2006/07/14 04:27:24;  author: starksm;  state: Exp;system2/src/tests/org/jboss/test/profileservice/simple1/ManagementViewImpl.java
  
  Index: ManagementViewImpl.java
  ===================================================================
  /*
    * 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.simple1;
  
  import java.io.IOException;
  import java.util.HashMap;
  
  import org.jboss.deployers.spi.Deployment;
  import org.jboss.deployers.spi.management.ManagementView;
  import org.jboss.deployers.spi.management.ManagedObject;
  import org.jboss.profileservice.spi.NoSuchDeploymentException;
  import org.jboss.profileservice.spi.Profile;
  import org.jboss.profileservice.spi.ProfileKey;
  import org.jboss.profileservice.spi.NoSuchProfileException;
  import org.jboss.profileservice.spi.ProfileService;
  import org.jboss.beans.info.spi.PropertyInfo;
  
  /**
   * @author Scott.Stark at jboss.org
   * @version $Revision$
   */
  public class ManagementViewImpl
     implements ManagementView
  {
     private ProfileService ps;
  
     ManagementViewImpl(ProfileService ps)
     {
        this.ps = ps;
     }
  
     public ManagedObject getView(ProfileKey key, String deploymentName)
        throws NoSuchProfileException, NoSuchDeploymentException
     {
        Profile profile = ps.getProfile(key);
        Deployment d = profile.getDeployment(deploymentName);
        ManagedObject mo = d.getManagedObject();
        return mo;
     }
  
     public void setView(ProfileKey key, String deploymentName, HashMap<String, PropertyInfo> view)
        throws NoSuchProfileException, IOException
     {
     }
  }
  
  
  
  1.1      date: 2006/07/14 04:27:24;  author: starksm;  state: Exp;system2/src/tests/org/jboss/test/profileservice/simple1/ProfileImpl2.java
  
  Index: ProfileImpl2.java
  ===================================================================
  package org.jboss.test.profileservice.simple1;
  
  import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
  import org.jboss.beans.metadata.spi.BeanMetaData;
  import org.jboss.profileservice.spi.*;
  import org.jboss.deployers.spi.Deployment;
  import org.jboss.deployers.spi.management.ManagedObject;
  
  import java.util.HashMap;
  import java.util.ArrayList;
  import java.util.Map;
  import java.io.IOException;
  import java.net.URL;
  
  /**
   * A test profile for deploying pretend Datasources
   *
   * @author ccrouch at jboss.org
   * @version $Revision$
   */
  public class ProfileImpl2
     implements Profile
  {
     private HashMap<String, Deployment> deployments;
  
     public ProfileImpl2() throws IOException
     {
        deployments = new HashMap<String, Deployment>();
        String deployDir = SecurityActions.getSystemProperty("jbosstest.deploy.dir");
        URL libURL;
        if( deployDir == null )
        {
           // Used codesource + ../lib
           URL classes = getClass().getProtectionDomain().getCodeSource().getLocation();
           libURL = new URL(classes, "../lib-not-found/");
        }
        else
        {
           libURL = new URL(deployDir);
        }
  
        DeploymentImpl p0 = new DeploymentImpl();
        p0.setName("DefaultDS");
        p0.setRootURL(libURL);
        String[] files = {"p0-not-here.jar"};
        p0.setFiles(files);
        /*
        ArrayList<DeploymentBean> beans = new ArrayList<DeploymentBean>();
  
        // DefaultDS datasource
        // ignoring dependencies on TxMgr for right now
        String defaultConnFacName = "name=DefaultDS,service=ManagedConnectionFactory";
        DeploymentBeanImpl<BeanMetaData> defaultConnFac = new DeploymentBeanImpl<BeanMetaData>(defaultConnFacName,
                 "org.jboss.test.profileservice.profiles.p0.beans.RARDeployment");
        AbstractBeanMetaData amd1 = new AbstractBeanMetaData(defaultConnFacName,
           "org.jboss.test.profileservice.profiles.p0.beans.RARDeployment");
        defaultConnFac.setBeanMetaData(amd1);
        beans.add(defaultConnFac);
  
        String defaultLocalTxCMName = "name=DefaultDS,service=LocalTxCM";
        DeploymentBeanImpl<BeanMetaData> defaultLocalTxCM = new DeploymentBeanImpl<BeanMetaData>(defaultLocalTxCMName,
                "org.jboss.test.profileservice.profiles.p0.beans.TxConnectionManager");
        AbstractBeanMetaData amd2 = new AbstractBeanMetaData(defaultLocalTxCMName,
           "org.jboss.test.profileservice.profiles.p0.beans.TxConnectionManager");
        defaultLocalTxCM.setBeanMetaData(amd2);
        beans.add(defaultLocalTxCM);
  
        String defaultConnPoolName = "name=DefaultDS,service=ManagedConnectionPool";
        DeploymentBeanImpl<BeanMetaData> defaultConnPool = new DeploymentBeanImpl<BeanMetaData>(defaultConnPoolName,
                "org.jboss.test.profileservice.profiles.p0.beans.JBossManagedConnectionPool");
        AbstractBeanMetaData amd3 = new AbstractBeanMetaData(defaultConnPoolName,
           "org.jboss.test.profileservice.profiles.p0.beans.JBossManagedConnectionPool");
        defaultConnPool.setBeanMetaData(amd3);
        beans.add(defaultConnPool);
  
        DeploymentBean[] tmp = new DeploymentBean[beans.size()];
        p0.setBeans(beans.toArray(tmp));
  
        // eventually this should get populated by examining the annotations on the beans described by the
        // deploymentBeans above
  
        // We will have to use something like ManagedPropertyRef in order to perform round trip operations,
        // since the PropertyInfoImpl objects don't have any knowledge of the beans used to populate them
        ManagedObject localDataSource = new ManagedObject();
       // localDataSource.addPropertyRef(new PropertyInfoImpl("Connection Factory Property 1", "a property passed to the connection factory"));  // connectionFactoryProperty1
       // localDataSource.addPropertyRef(new PropertyInfoImpl("Track Connection By Tx", "whether to track conns by txn or not"));   // trackConnectionByTx
  
  
       // localDataSource.addPropertyRef(new PropertyInfoImpl("Blocking Timeout Millis", "how long to block for"));   // blockingTimeoutMillis
        // how do we specify using PropertyInfo that this is a read-only field?
       // localDataSource.addPropertyRef(new PropertyInfoImpl("Connection Created Count", "STAT: # of conn's created"));   // connectionCreatedCount
  
        // how do we deal with wanting to have another ManagedObject representing the Pool separate from the one
        // representing the DataSource, since there is a one-to-one mapping between ManagedObject's and Deployment's
        p0.setManagedObject(localDataSource);
  
        deployments.put(p0.getName(), p0);
        */
  
        DeploymentImpl p1 = new DeploymentImpl();
        p1.setName("notxDS");
        p1.setRootURL(libURL);
        String[] files2 = {"p1-not-here.jar"};
        p1.setFiles(files);
  /*
        ArrayList<DeploymentBean> beans2 = new ArrayList<DeploymentBean>();
        // NoTx datasource
        // ignoring dependencies on TxMgr for right now
        String notxConnFacName = "name=notxDS,service=ManagedConnectionFactory";
        DeploymentBeanImpl<BeanMetaData> notxConnFac = new DeploymentBeanImpl<BeanMetaData>(notxConnFacName,
           "org.jboss.test.profileservice.profiles.p0.beans.RARDeployment");
        AbstractBeanMetaData amd4 = new AbstractBeanMetaData(notxConnFacName,
           "org.jboss.test.profileservice.profiles.p0.beans.RARDeployment");
        notxConnFac.setBeanMetaData(amd4);
        beans2.add(notxConnFac);
  
        // specify the correct ConnMgr for this DataSource
        String notxNoTxCMName = "name=notxDS,service=NoTxCM";
        DeploymentBeanImpl<BeanMetaData> notxNoTxCM = new DeploymentBeanImpl<BeanMetaData>(notxNoTxCMName,
           "org.jboss.test.profileservice.profiles.p0.beans.NoTxConnectionManager");
        AbstractBeanMetaData amd41 = new AbstractBeanMetaData(notxNoTxCMName,
           "org.jboss.test.profileservice.profiles.p0.beans.NoTxConnectionManager");
        notxNoTxCM.setBeanMetaData(amd41);
        beans2.add(notxNoTxCM);
  
        String notxConnPoolName = "name=notxDS,service=ManagedConnectionPool";
        DeploymentBeanImpl<BeanMetaData> notxConnPool = new DeploymentBeanImpl<BeanMetaData>(notxConnPoolName,
           "org.jboss.test.profileservice.profiles.p0.beans.JBossManagedConnectionPool");
        AbstractBeanMetaData amd5 = new AbstractBeanMetaData(notxConnPoolName,
           "org.jboss.test.profileservice.profiles.p0.beans.JBossManagedConnectionPool");
        notxConnPool.setBeanMetaData(amd5);
        beans2.add(notxConnPool);
  
        DeploymentBean[] tmp2 = new DeploymentBean[beans2.size()];
        p1.setBeans(beans2.toArray(tmp2));
  */
        ManagedObject notxDataSource = new ManagedObject();
        PropertyInfo jndiNameProperty = new PropertyInfoImpl("jndiName", SimpleType.STRING);
        jndiNameProperty.setFields(new String[] {
          //"defaultValue",
          //"descriptionResourceBundleBaseName",
          //"descriptionResourceKey",
          //"legalValues",
          //"maxValue",
          //"metricValue",
          //"minValue",
          //"openType",
          //"units",
          "org.jboss.profileservice.description",
          "org.jboss.profileservice.label",
          //"org.jboss.profileservice.labelResourceBundleBaseName",
          //"org.jboss.profileservice.labelResourceKey",
          "org.jboss.profileservice.requiredNotEmpty",
          "org.jboss.profileservice.typicalLength"
          },
          new Object[] {
          //"defaultValue",
          //"descriptionResourceBundleBaseName",
          //"descriptionResourceKey",
          //"legalValues",
          //"maxValue",
          //"metricValue",
          //"minValue",
          //"openType",
          //"units",
          "The name the Datasource will be registered under in JNDI",
          "JNDI Name",
          //"org.jboss.profileservice.labelResourceBundleBaseName",
          //"org.jboss.profileservice.labelResourceKey",
          Boolean.TRUE,
          new Integer (30)
          });
  
        notxDataSource.addPropertyRef(jndiNameProperty);
  
        PropertyInfo useJavaContextProperty = new PropertyInfoImpl("useJavaContext", SimpleType.BOOLEAN);
        useJavaContextProperty.setFields(new String[] {
          "defaultValue",
          //"descriptionResourceBundleBaseName",
          //"descriptionResourceKey",
          //"legalValues",
          //"maxValue",
          //"metricValue",
          //"minValue",
          //"openType",
          //"units",
          "org.jboss.profileservice.description",
          "org.jboss.profileservice.label",
          //"org.jboss.profileservice.labelResourceBundleBaseName",
          //"org.jboss.profileservice.labelResourceKey",
          "org.jboss.profileservice.requiredNotEmpty",
          //"org.jboss.profileservice.typicalLength"
          },
          new Object[] {
          Boolean.TRUE,
          //"descriptionResourceBundleBaseName",
          //"descriptionResourceKey",
          //"legalValues",
          //"maxValue",
          //"metricValue",
          //"minValue",
          //"openType",
          //"units",
          "Whether the Datasource should be registered under java: in JNDI",
          "Use java: context",
          //"org.jboss.profileservice.labelResourceBundleBaseName",
          //"org.jboss.profileservice.labelResourceKey",
          Boolean.TRUE,
          //"org.jboss.profileservice.typicalLength"
          });
        notxDataSource.addPropertyRef(useJavaContextProperty);
  
  
        //notxDataSource.addPropertyRef(new PropertyInfoImpl("Connection Factory Property 1", "a property passed to the connection factory"));  // connectionFactoryProperty1
        // pick a property which is actually on the NoTxConnectionManager bean
        //notxDataSource.addPropertyRef(new PropertyInfoImpl("Security Domain Jndi Name", "security domain"));   // securityDomainJndiName
        //notxDataSource.addPropertyRef(new PropertyInfoImpl("Blocking Timeout Millis", "how long to block for"));   // blockingTimeoutMillis
        //notxDataSource.addPropertyRef(new PropertyInfoImpl("Connection Created Count", "STAT: # of conn's created"));   // connectionCreatedCount
  
        // how can we differentiate between the ManagedObject create above, for a LocalTxDataSource,
        // and the one in use now, for a NoTxDataSource?
        p1.setManagedObject(notxDataSource);
        deployments.put(p1.getName(), p1);
     }
  
     public String getVersion()
     {
        return "1.0.0";
     }
  
     public DeploymentTemplate getTemplate(String name)
     {
        return null;
     }
  
     public void addDeployment(Deployment d)
     {
        throw new UnsupportedOperationException("simple1 is read-only");
     }
  
     public void removeDeployment(String name)
     {
        throw new UnsupportedOperationException("simple1 is read-only");
     }
  
     public Deployment[] getDeployments()
     {
        Deployment[] tmp = new Deployment[deployments.size()];
        deployments.values().toArray(tmp);
        return tmp;
     }
  
     public Map<String, Object> getConfig()
     {
        return null;
     }
  
     public Deployment getDeployment(String name)
        throws NoSuchDeploymentException
     {
        Deployment d = deployments.get(name);
        if( d == null )
           throw new NoSuchDeploymentException(name);
        return d;
     }
  }
  
  
  
  1.1      date: 2006/07/14 04:27:24;  author: starksm;  state: Exp;system2/src/tests/org/jboss/test/profileservice/simple1/ProfileServiceImpl2.java
  
  Index: ProfileServiceImpl2.java
  ===================================================================
  package org.jboss.test.profileservice.simple1;
  
  import java.io.IOException;
  
  /**
   * A simple read-only profile service for testing the basic kernel bootstrap
   * and management view usecases.
   *
   * @author Scott.Stark at jboss.org
   * @version $Revision$
   */
  public class ProfileServiceImpl2
     extends ProfileServiceImpl
  {
     public ProfileServiceImpl2() throws IOException
     {
        defatulImpl = new ProfileImpl2();
     }
  
  }
  
  
  
  1.1      date: 2006/07/14 04:27:24;  author: starksm;  state: Exp;system2/src/tests/org/jboss/test/profileservice/simple1/DeploymentImpl.java
  
  Index: DeploymentImpl.java
  ===================================================================
  /*
    * 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.simple1;
  
  import java.net.URL;
  import java.util.Set;
  
  import org.jboss.deployers.spi.Deployment;
  import org.jboss.deployers.spi.DeploymentContext;
  import org.jboss.deployers.spi.management.ManagedObject;
  
  /**
   * A simple implementation of Deployment.
   * 
   * @author Scott.Stark at jboss.org
   * @version $Revision$
   */
  public class DeploymentImpl
     implements Deployment
  {
     private String type;
     private String name;
     private URL rootURL;
     private String[] files = {};
     private ManagedObject managedObject;
  
     public String getType()
     {
        return type;
     }
     public void setType(String type)
     {
        this.type = type;
     }
  
     public String getName()
     {
        return name;
     }
     public void setName(String name)
     {
        this.name = name;
     }
  
     public URL getRootURL()
     {
        return rootURL;
     }
     public void setRootURL(URL rootURL)
     {
        this.rootURL = rootURL;
     }
  
     public String[] getFiles()
     {
        return files;
     }
     public void setFiles(String[] files)
     {
        this.files = files;
     }
  
     public void setManagedObject(ManagedObject managedObject)
     {
        this.managedObject = managedObject;
     }
     public ManagedObject getManagedObject()
     {
        return managedObject;
     }
     public DeploymentContext getRootContext()
     {
        // TODO Auto-generated method stub
        return null;
     }
     public Set<String> getTypes()
     {
        // TODO Auto-generated method stub
        return null;
     }
  
  }
  
  
  



More information about the jboss-cvs-commits mailing list