[jboss-cvs] JBossAS SVN: r104082 - in projects/profileservice/trunk: core/src/main/java/org/jboss/profileservice/repository/artifact and 9 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Apr 20 11:18:36 EDT 2010


Author: emuckenhuber
Date: 2010-04-20 11:18:34 -0400 (Tue, 20 Apr 2010)
New Revision: 104082

Removed:
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/plugin/
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractLegacyDeploymentRepositoryFactory.java
Modified:
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/BasicRepositoryConfiguration.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/LegacyProfileFactory.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/NoopProfileFactory.java
   projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/profile.xml
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/AbstractDeployHandler.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/actions/AbstractDeploymentAddAction.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/AbstractManagedComponentRuntimeDispatcher.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedDeploymentProcessor.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedObjectProcessor.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedObjectRuntimeProcessor.java
   projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/deploy/support/DeployHandlerSupport.java
   projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/support/NoopManagementProxyFactory.java
   projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/support/TestComponentMetaData.java
   projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/test/SimpleViewUnitTestCase.java
Log:
update MO processing.

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/BasicRepositoryConfiguration.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/BasicRepositoryConfiguration.java	2010-04-20 15:14:47 UTC (rev 104081)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/BasicRepositoryConfiguration.java	2010-04-20 15:18:34 UTC (rev 104082)
@@ -68,8 +68,7 @@
    {
       return mutable;
    }
-   
-   @Override
+
    public ArtifactNotFoundHandler<T> getNotFoundHandler()
    {
       return notFoundHandler;

Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractLegacyDeploymentRepositoryFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractLegacyDeploymentRepositoryFactory.java	2010-04-20 15:14:47 UTC (rev 104081)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractLegacyDeploymentRepositoryFactory.java	2010-04-20 15:18:34 UTC (rev 104082)
@@ -1,89 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, 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.profileservice.repository.legacy;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.jboss.profileservice.profile.metadata.plugin.PropertyProfileSourceMetaData;
-import org.jboss.profileservice.repository.artifact.ArtifactRepositoryManager;
-import org.jboss.profileservice.spi.DeploymentRepository;
-import org.jboss.profileservice.spi.DeploymentRepositoryFactory;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public abstract class AbstractLegacyDeploymentRepositoryFactory implements DeploymentRepositoryFactory
-{
-
-   /** The repository types. */
-   private static final String[] types;
-   
-   /** The artifact repository manager. */
-   private ArtifactRepositoryManager repositoryManager;
-   
-   static
-   {
-      types = new String[] {
-            PropertyProfileSourceMetaData.class.getName()
-      };
-   }
-   
-   @Override
-   public DeploymentRepository createDeploymentRepository(ProfileKey key, ProfileSourceMetaData metaData)
-         throws Exception
-   {
-      if(key == null)
-      {
-         throw new IllegalArgumentException("null profile key");
-      }
-      if(metaData == null)
-      {
-         throw new IllegalArgumentException("null profile source meta data");
-      }
-      if(metaData instanceof PropertyProfileSourceMetaData == false)
-      {
-         throw new IllegalStateException("wrong meta data type " + metaData.getClass().getName());
-      }
-      URI[] uris = createUris((PropertyProfileSourceMetaData) metaData);
-      DeploymentRepository repository = null;
-      // FIXME We don't have access to description if it's mutable or not,
-      // so do deployment repositories still make sense ?
-      return repository;
-   }
-
-   @Override
-   public String[] getTypes()
-   {
-      return types;
-   }
-   
-   protected URI[] createUris(PropertyProfileSourceMetaData metaData) throws URISyntaxException
-   {
-      return new URI[] {new URI(metaData.getPath())};
-   }
-
-}
-

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/LegacyProfileFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/LegacyProfileFactory.java	2010-04-20 15:14:47 UTC (rev 104081)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/LegacyProfileFactory.java	2010-04-20 15:18:34 UTC (rev 104082)
@@ -22,8 +22,6 @@
 package org.jboss.profileservice.repository.legacy;
 
 import org.jboss.profileservice.profile.NoopProfile;
-import org.jboss.profileservice.profile.metadata.plugin.FarmingProfileMetaData;
-import org.jboss.profileservice.profile.metadata.plugin.HotDeploymentProfileMetaData;
 import org.jboss.profileservice.profile.metadata.plugin.PropertyProfileMetaData;
 import org.jboss.profileservice.spi.DeploymentRepositoryFactory;
 import org.jboss.profileservice.spi.Profile;
@@ -49,9 +47,6 @@
    static
    {
       types = new String[] { 
-               HotDeploymentProfileMetaData.class.getName(),
-               PropertyProfileMetaData.class.getName(),
-               FarmingProfileMetaData.class.getName()
             };
    }
 

Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/NoopProfileFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/NoopProfileFactory.java	2010-04-20 15:14:47 UTC (rev 104081)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/NoopProfileFactory.java	2010-04-20 15:18:34 UTC (rev 104082)
@@ -22,6 +22,9 @@
 package org.jboss.test.profileservice.support;
 
 import org.jboss.profileservice.profile.NoopProfile;
+import org.jboss.profileservice.profile.metadata.plugin.FarmingProfileMetaData;
+import org.jboss.profileservice.profile.metadata.plugin.HotDeploymentProfileMetaData;
+import org.jboss.profileservice.profile.metadata.plugin.PropertyProfileMetaData;
 import org.jboss.profileservice.spi.Profile;
 import org.jboss.profileservice.spi.ProfileFactory;
 import org.jboss.profileservice.spi.ProfileKey;
@@ -48,7 +51,11 @@
    
    public String[] getTypes()
    {
-      return null;
+      return new String[] {
+            PropertyProfileMetaData.class.getName(),
+            HotDeploymentProfileMetaData.class.getName(),
+            FarmingProfileMetaData.class.getName()
+      };
    }
 
 }

Modified: projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/profile.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/profile.xml	2010-04-20 15:14:47 UTC (rev 104081)
+++ projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/profile.xml	2010-04-20 15:18:34 UTC (rev 104082)
@@ -12,6 +12,7 @@
 		<constructor><parameter><inject bean="ProfileServiceConfig" /></parameter></constructor>
 		<property name="repositoryManager"><inject bean="ArtifactRepositoryManager" /></property>
 	</bean>
-	<bean name="Legacy Profile Factory" class="org.jboss.profileservice.repository.legacy.LegacyProfileFactory" />
+	
+	<bean name="NoopProfileFactory" class="org.jboss.test.profileservice.support.NoopProfileFactory" />
 
 </deployment>
\ No newline at end of file

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/AbstractDeployHandler.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/AbstractDeployHandler.java	2010-04-20 15:14:47 UTC (rev 104081)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/AbstractDeployHandler.java	2010-04-20 15:18:34 UTC (rev 104082)
@@ -45,6 +45,8 @@
 import org.jboss.profileservice.spi.action.ActionController;
 import org.jboss.profileservice.spi.action.ModificationStatus;
 import org.jboss.profileservice.spi.action.ProfileModificationType;
+import org.jboss.profileservice.spi.action.deployment.DeploymentAction;
+import org.jboss.profileservice.spi.action.deployment.DeploymentActionContext;
 import org.jboss.profileservice.spi.managed.ManagedProfile;
 
 /**
@@ -53,7 +55,7 @@
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
-public class AbstractDeployHandler
+public abstract class AbstractDeployHandler
 {
    
    /** The action controller. */
@@ -93,7 +95,7 @@
     * @param dtID the deployment id
     * @param contentIS the content IS
     */
-   protected void addDeployment(DeploymentID dtID, InputStream contentIS)
+   protected void addDeployment(DeploymentID dtID, InputStream contentIS) throws Exception
    {
       BasicProfileModificationRequest actions = new BasicProfileModificationRequest(ProfileModificationType.ADD);
       if(dtID.isCopyContent())
@@ -114,8 +116,14 @@
          ManagedProfile managed = actionController.getManagedProfile(TransientProfileActivator.getTransientProfileKey());
          if(managed != null && managed.getProfile().isMutable() && managed.getProfile() instanceof MutableProfile)
          {
-            MutableProfile mutable = MutableProfile.class.cast(managed.getProfile());
-            actions.addAction(mutable.getKey(), new DeploymentAddAction(dtID, mutable, null));
+            final MutableProfile mutable = MutableProfile.class.cast(managed.getProfile());
+            ProfileKey key = mutable.getKey();
+            DeploymentAction<? extends DeploymentActionContext> action = createWoraroundDistributeAction(key, dtID, contentIS, mutable);
+            if(action == null)
+            {
+               action = new DeploymentAddAction(dtID, mutable, null);
+            }
+            actions.addAction(key, action);
          }
          else
          {
@@ -130,6 +138,19 @@
    }
 
    /**
+    * FIXME
+    * 
+    * @param key
+    * @param dtID
+    * @param contentIS
+    * @param profile
+    * @return
+    * @throws NoSuchProfileException
+    */
+   protected abstract DeploymentAction<? extends DeploymentActionContext>
+         createWoraroundDistributeAction(ProfileKey key, DeploymentID dtID, InputStream contentIS, MutableProfile profile) throws Exception;
+
+   /**
     * Start a set of deployments.
     * 
     * @param deploymentNames the deployment names
@@ -199,9 +220,14 @@
             throw new NoSuchProfileException(key.getName());
          }
          Set<String> names = mappings.get(key);
-         for(String deploymentName : names)
+         for(final String deploymentName : names)
          {
-            actions.addAction(key, new DeploymentRemoveAction(managed, deploymentName, null));
+            DeploymentAction<? extends DeploymentActionContext> action = createWoraroundRemoveAction(key, managed, deploymentName);
+            if(action == null)
+            {
+               action = new DeploymentRemoveAction(managed, deploymentName, null);
+            }
+            actions.addAction(key, action);
          }
       }
       ModificationStatus status = actionController.perform(actions);
@@ -210,6 +236,18 @@
          throw new IllegalStateException("failed to remove deployments " + Arrays.asList(deploymentNames), status.getFailure());
       }
    }
+
+   /**
+    * FIXME
+    * 
+    * @param key
+    * @param profile
+    * @param name
+    * @return
+    * @throws NoSuchProfileException
+    */
+   protected abstract DeploymentAction<? extends DeploymentActionContext>
+         createWoraroundRemoveAction(ProfileKey key, ManagedProfile profile, String name) throws Exception;
    
    /**
     * Resolve the profiles for the names.

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/actions/AbstractDeploymentAddAction.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/actions/AbstractDeploymentAddAction.java	2010-04-20 15:14:47 UTC (rev 104081)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/actions/AbstractDeploymentAddAction.java	2010-04-20 15:18:34 UTC (rev 104082)
@@ -25,7 +25,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.profileservice.management.actions.AbstractTwoPhaseModificationAction;
 import org.jboss.profileservice.spi.MutableProfile;
-import org.jboss.profileservice.spi.action.ProfileModificationAction;
+import org.jboss.profileservice.spi.action.deployment.DeploymentAction;
 import org.jboss.profileservice.spi.action.deployment.DeploymentActionContext;
 
 /**
@@ -33,7 +33,7 @@
  * @version $Revision$
  */
 public abstract class AbstractDeploymentAddAction extends AbstractTwoPhaseModificationAction<DeploymentActionContext>
-      implements ProfileModificationAction<DeploymentActionContext>
+      implements DeploymentAction<DeploymentActionContext>
 {
 
    static final Logger log = Logger.getLogger("org.jboss.profileservice.deployment.action");

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/AbstractManagedComponentRuntimeDispatcher.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/AbstractManagedComponentRuntimeDispatcher.java	2010-04-20 15:14:47 UTC (rev 104081)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/AbstractManagedComponentRuntimeDispatcher.java	2010-04-20 15:18:34 UTC (rev 104082)
@@ -28,6 +28,7 @@
 import org.jboss.managed.api.ManagedOperation;
 import org.jboss.managed.api.ManagedParameter;
 import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metatype.api.types.MetaType;
 import org.jboss.metatype.api.values.MetaValue;
 import org.jboss.metatype.api.values.MetaValueFactory;
 import org.jboss.metatype.plugins.values.MetaValueFactoryBuilder;
@@ -92,14 +93,7 @@
          throw new UndeclaredThrowableException(t, "Failed to get property '" + property.getName() + "' on component '" + componentName + "'.");
       }
       MetaMapper mapper = property.getTransientAttachment(MetaMapper.class);
-      if(mapper != null)
-      {
-         return mapper.createMetaValue(property.getMetaType(), value);
-      }
-      else
-      {
-         return create(value);
-      }
+      return create(value, property.getMetaType(), mapper);
    }
 
    /**
@@ -107,16 +101,8 @@
     */
    public void set(Object componentName, ManagedProperty property, MetaValue metaValue)
    {
-      Object value = null;
       MetaMapper mapper = property.getTransientAttachment(MetaMapper.class);
-      if(mapper != null)
-      {
-         value = mapper.unwrapMetaValue(metaValue);
-      }
-      else
-      {
-         value = unwrap(metaValue);
-      }
+      Object value = unwrap(metaValue, mapper);
       try
       {
          set(componentName, property.getName(), value);
@@ -139,11 +125,8 @@
       {
          ManagedParameter mp = params[i];
          MetaMapper<?> mapper = mp.getTransientAttachment(MetaMapper.class);
-         if(mapper != null)
-            args[i] = mapper.unwrapMetaValue(param[i]);
-         else
-            args[i] = unwrap(param[i]);
          //
+         args[i] = unwrap(param[i], mapper);
          sig[i] = mp.getMetaType().getTypeName();
       }
       try
@@ -153,12 +136,10 @@
          MetaValue mvalue = null;
          if (value != null)
          {
+            MetaType type = operation.getReturnType();
             // Look for a return type MetaMapper
             MetaMapper returnTypeMapper = operation.getTransientAttachment(MetaMapper.class);
-            if (returnTypeMapper != null)
-               mvalue = returnTypeMapper.createMetaValue(operation.getReturnType(), value);
-            else
-               mvalue = create(value);
+            mvalue = create(value, type, returnTypeMapper);
          }
          return mvalue;
       }
@@ -169,6 +150,27 @@
    }
 
    /**
+    * Create a meta value.
+    * 
+    * @param <T> 
+    * @param value the value
+    * @param metaType the meta type
+    * @param mapper the meta mapper
+    * @return the meta value
+    */
+   protected <T> MetaValue create(T value, MetaType metaType, MetaMapper<T> mapper)
+   {
+      if(mapper != null)
+      {
+         return mapper.createMetaValue(metaType, value);
+      }
+      else
+      {
+         return create(value);
+      }
+   }
+   
+   /**
     * Create meta value.
     *
     * @param value the value
@@ -178,6 +180,26 @@
    {
       return valueFactory.create(value);
    }
+
+   /**
+    * Unwrap meta value.
+    * 
+    * @param <T>
+    * @param metaValue the meta value
+    * @param metaMapper the meta mapper
+    * @return unwrapped value
+    */
+   protected <T> Object unwrap(MetaValue metaValue, MetaMapper<T> metaMapper)
+   {
+      if(metaMapper != null)
+      {
+         return metaMapper.unwrapMetaValue(metaValue);
+      }
+      else
+      {
+         return unwrap(metaValue);
+      }
+   }
    
    /**
     * Unwrap meta value.

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedDeploymentProcessor.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedDeploymentProcessor.java	2010-04-20 15:14:47 UTC (rev 104081)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedDeploymentProcessor.java	2010-04-20 15:18:34 UTC (rev 104082)
@@ -28,6 +28,7 @@
 import org.jboss.deployers.spi.management.ContextStateMapper;
 import org.jboss.logging.Logger;
 import org.jboss.managed.api.DeploymentState;
+import org.jboss.managed.api.ManagedComponent;
 import org.jboss.managed.api.ManagedDeployment;
 import org.jboss.managed.api.ManagedObject;
 import org.jboss.managed.plugins.ManagedDeploymentImpl;
@@ -113,6 +114,15 @@
       if(state != null && md instanceof ManagedDeploymentImpl)
          ManagedDeploymentImpl.class.cast(md).setDeploymentState(state);
 
+      // Map any existing ManagedComponent types
+      if(md != null && md.getComponents() != null)
+      {
+         for(ManagedComponent comp : md.getComponents().values())
+         {
+            context.addManagedComponent(comp);
+         }
+      }
+      // Process managed objects
       Map<String, ManagedObject> mos = md.getManagedObjects();
       for(ManagedObject mo : mos.values())
       {

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedObjectProcessor.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedObjectProcessor.java	2010-04-20 15:14:47 UTC (rev 104081)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedObjectProcessor.java	2010-04-20 15:18:34 UTC (rev 104082)
@@ -138,19 +138,6 @@
       // Check for unresolved refs
       checkForReferences(key, mo);
 
-      // Map any existing ManagedComponent types
-      if(md != null && md.getComponents() != null)
-      {
-         for(ManagedComponent comp : md.getComponents().values())
-         {
-            if(trace)
-            {
-               log.trace("Updating ManagementComponent: "+comp);
-            }
-            context.addManagedComponent(comp);
-         }
-      }
-
       // Create ManagedComponents for ManagedObjects annotated with ManagementComponent
       ManagementComponent mc = getAnnotation(mo, ManagementComponent.class);
       if (mc != null)

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedObjectRuntimeProcessor.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedObjectRuntimeProcessor.java	2010-04-20 15:14:47 UTC (rev 104081)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedObjectRuntimeProcessor.java	2010-04-20 15:18:34 UTC (rev 104082)
@@ -353,9 +353,6 @@
          if (name != null)
          {
             state = getMappedState(name, runStateMapper);
-            
-            log.info("state for " + name + " is " + state);
-            
             if (comp instanceof MutableManagedComponent)
             {
                MutableManagedComponent mcomp = MutableManagedComponent.class.cast(comp);

Modified: projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/deploy/support/DeployHandlerSupport.java
===================================================================
--- projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/deploy/support/DeployHandlerSupport.java	2010-04-20 15:14:47 UTC (rev 104081)
+++ projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/deploy/support/DeployHandlerSupport.java	2010-04-20 15:18:34 UTC (rev 104082)
@@ -21,13 +21,19 @@
 */
 package org.jboss.test.profileservice.plugins.deploy.support;
 
+import java.io.InputStream;
 import java.net.URL;
 import java.util.Collection;
 import java.util.HashSet;
 
 import org.jboss.deployers.spi.management.deploy.DeploymentID;
 import org.jboss.profileservice.plugins.deploy.AbstractDeployHandler;
+import org.jboss.profileservice.spi.MutableProfile;
 import org.jboss.profileservice.spi.NoSuchDeploymentException;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.action.deployment.DeploymentAction;
+import org.jboss.profileservice.spi.action.deployment.DeploymentActionContext;
+import org.jboss.profileservice.spi.managed.ManagedProfile;
 
 /**
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
@@ -41,7 +47,7 @@
       return super.resolveDeploymentNames(names);
    }
    
-   public void addDeployment(URL url)
+   public void addDeployment(URL url) throws Exception
    {
       DeploymentID id = new DeploymentIDSupport(url, url.getFile());
       super.addDeployment(id, null);
@@ -72,5 +78,17 @@
       return names.toArray(new String[urls.length]);
    }
    
+   protected DeploymentAction<? extends DeploymentActionContext> createWoraroundDistributeAction(ProfileKey key,
+         DeploymentID dtID, InputStream contentIS, MutableProfile profile)
+   {
+      return null;
+   }
+   
+   protected DeploymentAction<? extends DeploymentActionContext> createWoraroundRemoveAction(ProfileKey key,
+         ManagedProfile profile, String name)
+   {
+      return null;
+   }
+   
 }
 

Modified: projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/support/NoopManagementProxyFactory.java
===================================================================
--- projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/support/NoopManagementProxyFactory.java	2010-04-20 15:14:47 UTC (rev 104081)
+++ projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/support/NoopManagementProxyFactory.java	2010-04-20 15:18:34 UTC (rev 104082)
@@ -80,8 +80,7 @@
 
       public <T extends Enum<?>> T mapControllerState(Object name, ContextStateMapper<T> mapper)
       {
-         // FIXME mapControllerState
-         return null;
+         return mapper != null ? mapper.map("Installed", null) : null;
       }
 
       public void set(Object componentName, ManagedProperty property, MetaValue value)

Modified: projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/support/TestComponentMetaData.java
===================================================================
--- projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/support/TestComponentMetaData.java	2010-04-20 15:14:47 UTC (rev 104081)
+++ projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/support/TestComponentMetaData.java	2010-04-20 15:18:34 UTC (rev 104082)
@@ -26,6 +26,7 @@
 import org.jboss.managed.api.annotation.ManagementObject;
 import org.jboss.managed.api.annotation.ManagementObjectID;
 import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ManagementRuntimeRef;
 
 /**
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
@@ -56,6 +57,7 @@
    
    @ManagementObjectID(type = "Test")
    @ManagementProperty(name = "name")
+   @ManagementRuntimeRef()
    public String getName()
    {
       return name;

Modified: projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/test/SimpleViewUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/test/SimpleViewUnitTestCase.java	2010-04-20 15:14:47 UTC (rev 104081)
+++ projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/test/SimpleViewUnitTestCase.java	2010-04-20 15:18:34 UTC (rev 104082)
@@ -23,6 +23,7 @@
 
 import org.jboss.managed.api.ManagedComponent;
 import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.managed.api.RunState;
 import org.jboss.profileservice.plugins.management.util.ManagedDeploymentProcessor;
 import org.jboss.profileservice.plugins.management.view.AbstractProfileView;
 import org.jboss.test.profileservice.plugins.mgt.support.TestComponentMetaData;
@@ -66,21 +67,6 @@
       assertNotNull("two", view.getComponent("two", TestComponentMetaData.componentType));
       assertNotNull("three", view.getComponent("three", TestComponentMetaData.componentType));
    }
-
-//   public void testSimpleService() throws Exception
-//   {
-//      AbstractProfileView view = new AbstractProfileView();
-//     
-//      // Create the deployment
-//      ManagedDeployment md = createDeployment("test.1", createServiceMetaData("one", "two", "three"));
-//      // Process
-//      getHelper().processRootManagedDeployment(md, view);
-//      
-//      assertNotNull("one", view.getComponent("one", TestServiceComponentMetaData.componentType));
-//      assertNotNull("two", view.getComponent("two", TestServiceComponentMetaData.componentType));
-//      assertNotNull("three", view.getComponent("three", TestServiceComponentMetaData.componentType));      
-//   }
-
    
    public void testSimpleMerge() throws Exception
    {
@@ -99,6 +85,8 @@
       ManagedComponent one = view.getComponent("one", TestComponentMetaData.componentType);
       assertNotNull(one.getOperations());
       assertTrue(one.getOperations().size() > 0);
+   
+      assertEquals(RunState.RUNNING, one.getRunState());
       
       assertNotNull(one.getProperty("attachment-property"));
       assertNotNull(one.getProperty("runtime-property"));




More information about the jboss-cvs-commits mailing list