directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jcon...@apache.org
Subject svn commit: r501176 [6/6] - in /directory/sandbox/jconlon/osgi-services/configuration-service: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/configuration/ src/main/java/org/apache/configuration/...
Date Mon, 29 Jan 2007 20:38:29 GMT
Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/RegistrationChangeIntegrationTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/RegistrationChangeIntegrationTest.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/RegistrationChangeIntegrationTest.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/RegistrationChangeIntegrationTest.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,509 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+
+package org.apache.configuration.event;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import junit.framework.TestCase;
+
+import org.apache.configuration.dao.ConfigurationDao;
+import org.apache.configuration.dao.jndi.ContextMapping;
+import org.apache.configuration.impl.ConfigurationAdminServiceFactory;
+import org.apache.configuration.impl.ConfigurationDictionary;
+import org.apache.configuration.impl.ConfigurationStoreImpl;
+import org.apache.configuration.util.ApacheDSUtil;
+import org.osgi.framework.Constants;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.cm.ConfigurationEvent;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ConfigurationListener;
+import org.osgi.service.cm.ManagedService;
+import org.osgi.service.cm.ManagedServiceFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.osgi.mock.MockBundle;
+import org.springframework.osgi.mock.MockServiceReference;
+import org.springframework.osgi.mock.MockServiceRegistration;
+
+
+/**
+ * ConfigurationImplTest tests the ConfigurationImpl with an embeded JNDI ConfigurationDao infrastructure.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class RegistrationChangeIntegrationTest extends TestCase implements ConfigurationListener
+{
+
+    private static final String SOME_FACTORY = "some.factory.pid";
+    private static final String SOME_PID = "some.pid";
+    private static final String SOME_CN = "someCn";
+    /** the log for this class */
+    private static final Logger log = LoggerFactory.getLogger( RegistrationChangeIntegrationTest.class );
+
+    static
+    {
+        File file = new File( "server-work" );
+        if ( file.exists() )
+        {
+            log.debug( "Removing the server-work directory. " );
+            ApacheDSUtil.deleteDir(file);
+        }
+    }
+
+
+    private CyclicBarrier listenerReceivedEventBarrier;
+    private CyclicBarrier registrationReceivedEventBarrier;
+    private ConfigurationStoreImpl configurationStore;
+    private ConfigurationDao configurationDao;
+    private ConfigurationChangeManager configurationDaoEventListener;
+    
+    
+    
+    private MockServiceReference mockServiceReference;
+    private MockManagedServiceTrackingDelegate mockManagedServiceTrackingDelegate;
+    private ManagedServiceTrackerCustomizer managedServiceTrackerCustomizer;
+//    private MyManagedService myManagedService ;
+    
+    private MockServiceReference mockServiceFactoryReference;
+    private MockManagedServiceFactoryTrackingDelegate mockManagedServiceFactoryTrackingDelegate;
+    private ManagedServiceFactoryTrackerCustomizer managedServiceFactoryTrackerCustomizer;
+//    private MyManagedServiceFactory myManagedServiceFactory ;
+    
+    private ConfigurationAdminServiceFactory configurationAdminServiceFactory;
+    private Dictionary updatedManagedServiceDictionary;
+    private Dictionary updatedManagedServiceFactoryDictionary;
+    ConfigurationEvent event = null;
+    
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        listenerReceivedEventBarrier = new CyclicBarrier(2);
+        
+        ApplicationContext ctx = new ClassPathXmlApplicationContext(
+            new String[]{ 
+                "mockInitialContextFactory.xml", 
+                "META-INF/spring/daoJndi.xml", 
+                "META-INF/spring/event.xml",
+                "META-INF/spring/configuration.xml",
+                "event.xml"});
+        
+        configurationStore = ( ConfigurationStoreImpl ) ctx.getBean( "configurationStore" );
+        configurationDao = ( ConfigurationDao ) ctx.getBean( "configurationDao" );
+        configurationAdminServiceFactory= 
+            ( ConfigurationAdminServiceFactory ) ctx.getBean( "configurationAdminServiceFactory" );
+        
+        configurationDaoEventListener=
+            ( ConfigurationChangeManager ) ctx.getBean( "configurationDaoEventListener" );
+        configurationDaoEventListener.setConfigurationListener( this );
+        
+        mockServiceReference = ( MockServiceReference ) ctx.getBean( "mockServiceReference");
+        mockManagedServiceTrackingDelegate= ( MockManagedServiceTrackingDelegate ) ctx.getBean( "mockManagedServiceTrackingDelegate");
+        mockManagedServiceTrackingDelegate.setService( new MyManagedService() );
+        managedServiceTrackerCustomizer= ( ManagedServiceTrackerCustomizer ) ctx.getBean( "managedServiceTrackerCustomizer");
+        
+        
+        mockServiceFactoryReference = ( MockServiceReference ) ctx.getBean( "mockServiceFactoryReference");
+        mockManagedServiceFactoryTrackingDelegate= ( MockManagedServiceFactoryTrackingDelegate ) ctx.getBean( "mockManagedServiceFactoryTrackingDelegate");
+        mockManagedServiceFactoryTrackingDelegate.setService( new MyManagedServiceFactory() );
+        managedServiceFactoryTrackerCustomizer= ( ManagedServiceFactoryTrackerCustomizer ) ctx.getBean( "managedServiceFactoryTrackerCustomizer");
+        
+    }
+
+
+    /* (non-Javadoc)
+     * 
+     * @see junit.framework.TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception
+    {
+       
+        configurationDao=null;
+       
+        mockManagedServiceTrackingDelegate=null;
+        managedServiceTrackerCustomizer = null;
+        mockManagedServiceFactoryTrackingDelegate=null;
+        configurationStore = null;
+        updatedManagedServiceDictionary=null;
+        updatedManagedServiceFactoryDictionary = null;
+        configurationAdminServiceFactory=null;
+        event = null;
+
+        updatedManagedServiceDictionary = null;
+        updatedManagedServiceFactoryDictionary = null;
+        configurationDaoEventListener=null;
+        super.tearDown();
+    }
+
+    public void testEnvironment(){
+        assertNotNull( configurationDao);
+        assertNotNull( configurationStore);
+        assertNotNull( mockManagedServiceTrackingDelegate);
+        assertNotNull( mockManagedServiceFactoryTrackingDelegate);
+        assertNotNull( configurationAdminServiceFactory);
+        assertNotNull(configurationDaoEventListener);
+        assertNotNull(managedServiceTrackerCustomizer);
+        assertNotNull(mockServiceReference);
+        
+    }
+    
+    public void testWithACleanEnvironment(){
+        List<ConfigurationDictionary> configs = configurationDao.findAll();
+        if(configs==null || configs.isEmpty()){
+            return;
+        }
+        
+        log.debug( "Deleting {} configurationDictionary entries {}.", configs.size(),configs );
+        for ( ConfigurationDictionary configurationDictionary : configs )
+        {
+            
+            log.debug( "Deleting configurationDictionary entry {}.", configurationDictionary );
+            configurationDao.delete( configurationDictionary );
+        }
+        
+        assertTrue( configurationDao.findAll().isEmpty());
+        assertTrue( configurationStore.listPids().isEmpty());
+    }
+
+   
+    
+    /**
+     * 
+     * Register a ManagedService by adding a ServiceReference
+     * to the managedServiceTrackerCustomizer.
+     * 
+     * The serviceReference must be in the MockBundleContext and it
+     * must reference the 
+     * 
+     * The mockBundleContext must be able to resolve:
+     * ManagedService managedService = (ManagedService) bundleContext.getService( serviceReference );
+                        
+     * addingService( final ServiceReference serviceReference )
+     * 
+     */
+    public void testRegisterManagedService(){
+        
+        ConfigurationAdmin configurationAdmin = getConfigAdmin();
+        Configuration configuration = null;
+        try
+        {
+            configuration =configurationAdmin.getConfiguration( SOME_PID );
+        }
+        catch ( IOException e )
+        {
+            log.error( "Failed to getConfiguration.",e );
+            fail(e.toString());
+        }
+        assertNotNull(configuration);
+        ConfigurationDictionary configurationDictionary = 
+            createConfigurationDictionaryInstance(SOME_CN, SOME_PID, null);
+        try
+        {
+            configuration.update(configurationDictionary);
+        }
+        catch ( IOException e )
+        {
+            fail(e.toString());
+        }
+        catch (Exception e)
+        {
+            fail(e.toString());
+        }
+        
+        //Wait for the update async event to be sent 
+        try
+        {
+            listenerReceivedEventBarrier.await( 3, TimeUnit.SECONDS );
+        }
+        catch ( InterruptedException e )
+        {
+            fail(e.toString());
+        }
+        catch ( BrokenBarrierException e )
+        {
+            fail(e.toString());
+        }
+        catch ( TimeoutException e )
+        {
+            fail(e.toString());
+        }
+        assertNotNull(event);
+        assertNotNull(updatedManagedServiceDictionary);
+        assertNull(updatedManagedServiceFactoryDictionary);
+        
+        
+        //null the updated ManagedServiceDictionary
+        registrationReceivedEventBarrier = new CyclicBarrier(2);
+        updatedManagedServiceDictionary=null;
+        managedServiceTrackerCustomizer.addingService( mockServiceReference );
+        
+        try
+        {
+            registrationReceivedEventBarrier.await( 3, TimeUnit.SECONDS );
+        }
+        catch ( InterruptedException e )
+        {
+            fail(e.toString());
+        }
+        catch ( BrokenBarrierException e )
+        {
+            fail(e.toString());
+        }
+        catch ( TimeoutException e )
+        {
+            fail("Failed to update the service.");
+        }
+        
+        assertNotNull(updatedManagedServiceDictionary);
+     }
+    
+    
+    /**
+     * 
+     * Register a ManagedService by adding a ServiceReference
+     * to the managedServiceTrackerCustomizer.
+     * 
+     * The serviceReference must be in the MockBundleContext and it
+     * must reference the 
+     * 
+     * The mockBundleContext must be able to resolve:
+     * ManagedService managedService = (ManagedService) bundleContext.getService( serviceReference );
+                        
+     * addingService( final ServiceReference serviceReference )
+     * 
+     */
+    public void testRegisterManagedServiceFactory(){
+        ConfigurationAdmin configurationAdmin = getConfigAdmin();
+        Configuration configuration = null;
+        try
+        {
+            configuration =configurationAdmin.createFactoryConfiguration( SOME_FACTORY );
+        }
+        catch ( IOException e )
+        {
+            log.error( "Failed to getConfiguration.",e );
+            fail(e.toString());
+        }
+        assertNotNull(configuration);
+        ConfigurationDictionary configurationDictionary = 
+            createConfigurationDictionaryInstance(SOME_CN, SOME_PID, SOME_FACTORY);
+        try
+        {
+            configuration.update(configurationDictionary);
+        }
+        catch ( IOException e )
+        {
+            fail(e.toString());
+        }
+        catch (Exception e)
+        {
+            fail(e.toString());
+        }
+        
+        //Wait for the async event to be sent 
+        try
+        {
+            listenerReceivedEventBarrier.await( 3, TimeUnit.SECONDS );
+        }
+        catch ( InterruptedException e )
+        {
+            fail(e.toString());
+        }
+        catch ( BrokenBarrierException e )
+        {
+            fail(e.toString());
+        }
+        catch ( TimeoutException e )
+        {
+            fail("Failed to update the ManagedServiceFactory.");
+        }
+        assertNotNull(event);
+        assertNotNull(updatedManagedServiceFactoryDictionary);
+        assertNull(updatedManagedServiceDictionary);
+        
+        //null the updated ManagedServiceDictionary
+        registrationReceivedEventBarrier = new CyclicBarrier(2);
+        updatedManagedServiceFactoryDictionary=null;
+        managedServiceFactoryTrackerCustomizer.addingService( mockServiceFactoryReference );
+        
+        try
+        {
+            registrationReceivedEventBarrier.await( 3, TimeUnit.SECONDS );
+        }
+        catch ( InterruptedException e )
+        {
+            fail(e.toString());
+        }
+        catch ( BrokenBarrierException e )
+        {
+            fail(e.toString());
+        }
+        catch ( TimeoutException e )
+        {
+            fail("Failed to update the service.");
+        }
+        
+        assertNotNull(updatedManagedServiceFactoryDictionary);
+     }
+    
+    
+    
+    
+    
+    
+    
+    /**
+     * A utility method for building a configAdmin.
+     *
+     * @return
+     */
+    private ConfigurationAdmin getConfigAdmin()
+    {
+        MockBundle bundle = new MockBundle();
+           MockServiceRegistration serviceRegistration = new MockServiceRegistration();
+           Object o = configurationAdminServiceFactory.getService( bundle, serviceRegistration );
+           assertNotNull(o);
+           assertTrue(o instanceof ConfigurationAdmin);
+           ConfigurationAdmin configurationAdmin = (ConfigurationAdmin)o;
+        return configurationAdmin;
+    }
+    
+    private ConfigurationDictionary createConfigurationDictionaryInstance(String cn, String pid, String factory)
+    {
+        Vector<String> objectclass = new Vector<String>();
+        objectclass.add( "top" );
+        objectclass.add( ContextMapping.APACHEDS_SERVICE_CONFIGURATION_OBJECTCLASS );
+        Dictionary<String,Object> dictionary = new Hashtable<String,Object>();
+        dictionary.put( Constants.SERVICE_PID, pid );
+        if(factory !=null){
+            dictionary.put( ConfigurationAdmin.SERVICE_FACTORYPID , factory );
+        }
+        dictionary.put( "objectclass", objectclass );
+        dictionary.put( "cn", cn );
+        
+        
+        ConfigurationDictionary configurationDictionary = new ConfigurationDictionary(dictionary);
+        
+        return configurationDictionary;
+    }
+    
+    /**
+     * Implements ConfigurationListener to receive configuration events
+     * coming from the executor.
+     */
+    public void configurationEvent( ConfigurationEvent event )
+    {
+        this.event=event;
+        try
+        {
+            listenerReceivedEventBarrier.await();
+        }
+        catch ( InterruptedException e )
+        {
+           log.error( "Barrier exception.",e );
+        }
+        catch ( BrokenBarrierException e )
+        {
+            log.error( "Barrier exception.",e );
+        }
+        
+    }
+    
+    class MyManagedService implements ManagedService {
+
+        public void updated( Dictionary properties ) throws ConfigurationException
+        {
+           
+            updatedManagedServiceDictionary=properties;
+            if(registrationReceivedEventBarrier!=null){
+                try
+                {
+                    registrationReceivedEventBarrier.await();
+                }
+                catch ( InterruptedException e )
+                {
+                  //ignore
+                }
+                catch ( BrokenBarrierException e )
+                {
+                    //ignore
+                }
+            }
+            
+        }
+        
+    }
+    
+    class MyManagedServiceFactory implements ManagedServiceFactory {
+        public void deleted( String pid )
+        {
+            if(updatedManagedServiceFactoryDictionary.get( Constants.SERVICE_PID ).equals( pid )){
+              updatedManagedServiceFactoryDictionary=null;
+            }else{
+                log.error( "Wrong deletion pid received "+pid );
+            }
+            
+        }
+
+        public String getName()
+        {
+//          ignore
+            return null;
+        }
+
+        public void updated( String pid, Dictionary properties ) throws ConfigurationException
+        {
+            updatedManagedServiceFactoryDictionary=properties;
+            if(registrationReceivedEventBarrier!=null){
+                try
+                {
+                    registrationReceivedEventBarrier.await();
+                }
+                catch ( InterruptedException e )
+                {
+                    //ignore
+                }
+                catch ( BrokenBarrierException e )
+                {
+                   //ignore
+                }
+            }
+            
+        }
+        
+    }
+}

Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/impl/ConfigurationStoreImplTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/impl/ConfigurationStoreImplTest.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/impl/ConfigurationStoreImplTest.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/impl/ConfigurationStoreImplTest.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,734 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+
+package org.apache.configuration.impl;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
+
+import junit.framework.TestCase;
+
+import org.apache.configuration.dao.ConfigurationDao;
+import org.apache.configuration.dao.ConfigurationDaoException;
+import org.apache.configuration.dao.ConfigurationDaoListener;
+import org.apache.configuration.dao.jndi.ContextMapping;
+import org.apache.configuration.impl.ConfigurationDictionary;
+import org.apache.configuration.impl.ConfigurationStore;
+import org.apache.configuration.util.ApacheDSUtil;
+import org.osgi.framework.Constants;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.cm.ConfigurationException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+
+/**
+ * 
+ * ConfigurationStoreImplTest tests the ConfigurationImpl with an embeded JNDI ConfigurationDao infrastructure.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ConfigurationStoreImplTest extends TestCase implements ConfigurationDaoListener
+{
+
+    private static final String START_TEST = "Start test ======================================================";
+    private static final String FILTER = "(service.factoryPid=some*)";
+    private static final String SOME_PID_3 = "some.pid.3";
+    private static final String SOME_PID_2 = "some.pid.2";
+    private static final String SOME_FACTORY_PID_2 = "someReplaced.factory";
+    private static final String SOME_CN = "mytestConfiguration2";
+    private static final String SOME_PID = "some.pid";
+    private static final String SOME_FACTORY_PID = "someFactoryPid";
+    private static final String SOME_BUNDLE_LOCATION = "someBundleLocation";
+    /** the log for this class */
+    private static final Logger log = LoggerFactory.getLogger( ConfigurationStoreImplTest.class );
+
+    static
+    {
+        File file = new File( "server-work" );
+        if ( file.exists() )
+        {
+            log.debug( "Removing the server-work directory. " );
+            ApacheDSUtil.deleteDir( file );
+        }
+    }
+
+    private ConfigurationStore configurationStore;
+    private ConfigurationDao configurationDao;
+    private ConfigurationDictionary changedConfigurationDictionary;
+    private ChangeType changeType;
+
+
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        ApplicationContext ctx = new ClassPathXmlApplicationContext( new String[]
+            { "mockInitialContextFactory.xml", 
+              "mockConfigurationDaoEventListener.xml", 
+              "META-INF/spring/daoJndi.xml",
+                "META-INF/spring/configuration.xml" } );
+
+        configurationStore = ( ConfigurationStore ) ctx.getBean( "configurationStore" );
+        configurationDao = ( ConfigurationDao ) ctx.getBean( "configurationDao" );
+        configurationStore.setConfigurationDaoListener( this );
+        //TODO Use this method for cleaning the directory in the setUp of other tests. 
+        Set<String> pids = configurationStore.listPids();
+        for ( String pid : pids )
+        {
+            configurationStore.delete( pid );
+        }
+
+    }
+
+
+    protected void tearDown() throws Exception
+    {
+        configurationDao = null;
+        configurationStore = null;
+        changedConfigurationDictionary = null;
+        changeType = null;
+
+        super.tearDown();
+    }
+
+
+    public void testWithACleanEnvironment()
+    {
+        List<ConfigurationDictionary> configs = configurationDao.findAll();
+        if ( configs == null || configs.isEmpty() )
+        {
+            return;
+        }
+
+        log.debug( "Deleting {} configurationDictionary entries {}.", configs.size(), configs );
+        for ( ConfigurationDictionary configurationDictionary : configs )
+        {
+
+            log.debug( "Deleting configurationDictionary entry {}.", configurationDictionary );
+            configurationDao.delete( configurationDictionary );
+        }
+    }
+
+
+    public void testSpringConstructedConfiguationStore()
+    {
+        assertNotNull( "Setup construction failed", configurationStore );
+    }
+
+
+    public void testGetNewConfiguration_Location_Fpid_Spid()
+    {
+        Configuration configuration = configurationStore.getNewConfiguration( SOME_BUNDLE_LOCATION, SOME_FACTORY_PID,
+            SOME_PID );
+        assertNotNull( configuration );
+        assertEquals( SOME_PID, configuration.getPid() );
+        assertEquals( SOME_FACTORY_PID, configuration.getFactoryPid() );
+        assertEquals( SOME_BUNDLE_LOCATION, configuration.getBundleLocation() );
+        assertNull( configuration.getProperties() );
+    }
+
+
+    public void testGetNewConfiguration_Location_Fpid_Spid_Props()
+    {
+        ConfigurationDictionary properties = null;
+        Configuration configuration = configurationStore.getNewConfiguration( SOME_BUNDLE_LOCATION, SOME_FACTORY_PID,
+            SOME_PID, properties );
+        assertNotNull( configuration );
+        assertEquals( SOME_PID, configuration.getPid() );
+        assertEquals( SOME_FACTORY_PID, configuration.getFactoryPid() );
+        assertEquals( SOME_BUNDLE_LOCATION, configuration.getBundleLocation() );
+        assertNull( configuration.getProperties() );
+    }
+
+
+    public void testUpdate()
+    {
+        log.debug( START_TEST );
+
+        //Create an initial configuration.
+        ConfigurationDictionary configurationDictionary = createConfigurationDictionaryInstance( SOME_CN, SOME_PID_2,
+            SOME_FACTORY_PID );
+        try
+        {
+            configurationStore.update( configurationDictionary );
+        }
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+            fail( "Failed to Create an initial configuration. Because: " + e.toString() );
+
+        }
+        assertNotNull( "Listener failed send a changedConfigurationDictionary.", changedConfigurationDictionary );
+        assertNotNull( "Listener failed send a changeType.", changeType );
+        assertEquals( ChangeType.CREATED, changeType );
+        assertEquals( SOME_PID_2, changedConfigurationDictionary.getServicePid() );
+        //Should not modify my copy of the dictionary adversly
+        assertNull( "Should not find key " + ContextMapping.APACHEDS_SERVICE_PID + " in " + configurationDictionary,
+            configurationDictionary.get( ContextMapping.APACHEDS_SERVICE_PID ) );
+
+        assertNotNull( "Could not find key " + Constants.SERVICE_PID + " in " + configurationDictionary,
+            configurationDictionary.get( Constants.SERVICE_PID ) );
+
+        configurationDictionary = configurationDao.read( SOME_PID_2 );
+        assertNotNull( "Failed to Create an initial configuration.", configurationDictionary );
+        assertNull( "Should not find key " + ContextMapping.APACHEDS_SERVICE_PID + " in " + configurationDictionary,
+            configurationDictionary.get( ContextMapping.APACHEDS_SERVICE_PID ) );
+
+        assertNotNull( "Could not find key " + Constants.SERVICE_PID + " in " + configurationDictionary,
+            configurationDictionary.get( Constants.SERVICE_PID ) );
+
+        assertEquals( "Failed to Create an initial configuration.", SOME_PID_2, configurationDictionary
+            .get( Constants.SERVICE_PID ) );
+        assertEquals( "Failed to Create an initial configuration.", SOME_FACTORY_PID, configurationDictionary
+            .get( ConfigurationAdmin.SERVICE_FACTORYPID ) );
+
+        //Update configuration FactoryPid Prop
+        configurationDictionary = createConfigurationDictionaryInstance( SOME_CN, SOME_PID_2, SOME_FACTORY_PID_2 );
+
+        try
+        {
+            configurationStore.update( configurationDictionary );
+
+        }
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+            fail( "Failed to Update configuration FactoryPid Prop in dao.  Because: " + e.toString() );
+
+        }
+        configurationDictionary = configurationDao.read( SOME_PID_2 );
+
+        assertNotNull( "Failed to Update configuration FactoryPid Prop in dao.", configurationDictionary );
+        assertEquals( "Failed to Update configuration FactoryPid Prop in dao.", SOME_PID_2, configurationDictionary
+            .get( Constants.SERVICE_PID ) );
+        assertEquals( "Failed to Update configuration FactoryPid Prop in dao.", SOME_FACTORY_PID_2,
+            configurationDictionary.get( ConfigurationAdmin.SERVICE_FACTORYPID ) );
+
+        //Should be able to get one from the store
+        try
+        {
+            configurationDictionary = configurationStore.retrieve( SOME_PID_2 );
+        }
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+            fail( "Failed to Update configuration FactoryPid Prop in store.  Because: " + e.toString() );
+        }
+
+        assertNotNull( "Failed to Update configuration FactoryPid Prop in store.", configurationDictionary );
+        assertEquals( "Failed to Update configuration FactoryPid Prop in store.", SOME_PID_2, configurationDictionary
+            .get( Constants.SERVICE_PID ) );
+        assertEquals( "Failed to Update configuration FactoryPid Prop in store.", SOME_FACTORY_PID_2,
+            configurationDictionary.get( ConfigurationAdmin.SERVICE_FACTORYPID ) );
+
+        //Only one in the store right?
+        assertEquals( "Failed to only one configuration in the store.", 1, configurationStore.listPids().size() );
+
+        assertNotNull( "Listener failed send a changedConfigurationDictionary.", changedConfigurationDictionary );
+        assertNotNull( "Listener failed send a changeType.", changeType );
+        assertEquals( ChangeType.UPDATED, changeType );
+        assertEquals( SOME_PID_2, changedConfigurationDictionary.getServicePid() );
+        assertEquals( SOME_FACTORY_PID_2, changedConfigurationDictionary.getFactoryPid() );
+
+    }
+
+
+    public void testListPids()
+    {
+        log.debug( START_TEST );
+        ConfigurationDictionary configurationDictionary = createConfigurationDictionaryInstance( SOME_CN, SOME_PID_2,
+            SOME_FACTORY_PID );
+        try
+        {
+            configurationStore.update( configurationDictionary );
+        }
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+            fail( "Failed to Create an initial configuration. Because: " + e.toString() );
+
+        }
+        Set<String> pids = configurationStore.listPids();
+        assertNotNull( pids );
+        assertEquals( "Should be one pid from previous test", 1, pids.size() );
+        assertTrue( "Failed to only one configuration in the store.", pids.contains( SOME_PID_2 ) );
+    }
+
+
+    public void testAddingToCache()
+    {
+        log.debug( START_TEST );
+
+        ConfigurationDictionary configurationDictionary0 = createConfigurationDictionaryInstance( SOME_CN, SOME_PID_2,
+            SOME_FACTORY_PID );
+        try
+        {
+            configurationStore.update( configurationDictionary0 );
+        }
+        catch ( IOException e )
+        {
+            log.error( "Failed to update a configuration.", e );
+            fail( "Failed to Create an initial configuration. Because: " + e.toString() );
+
+        }
+
+        //Add second configuration to the store
+        ConfigurationDictionary configurationDictionary = createConfigurationDictionaryInstance( SOME_CN, SOME_PID_3,
+            SOME_FACTORY_PID );
+
+        try
+        {
+            configurationStore.update( configurationDictionary );
+        }
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+            fail( "Failed to Add second configuration to the store. Because: " + e.toString() );
+
+        }
+
+        Set<String> pids = configurationStore.listPids();
+        assertEquals( "Should be two configurations one from this and one from previous test", 2, configurationStore
+            .listPids().size() );
+        assertTrue( pids.contains( SOME_PID_2 ) );
+        assertTrue( pids.contains( SOME_PID_3 ) );
+
+    }
+
+
+    public void testRetrieve()
+    {
+        log.debug( START_TEST );
+
+        ConfigurationDictionary configurationDictionary0 = createConfigurationDictionaryInstance( SOME_CN, SOME_PID_2,
+            SOME_FACTORY_PID );
+        try
+        {
+            configurationStore.update( configurationDictionary0 );
+        }
+        catch ( IOException e )
+        {
+            log.error( "Failed to update a configuration.", e );
+            fail( "Failed to Create an initial configuration. Because: " + e.toString() );
+
+        }
+
+        ConfigurationDictionary config = null;
+        try
+        {
+            config = configurationStore.retrieve( SOME_PID_2 );
+
+        }
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+            fail( e.toString() );
+        }
+        assertNotNull( config );
+        assertEquals( SOME_PID_2, config.getServicePid() );
+
+        try
+        {
+            config = configurationStore.retrieve( "bogus" );
+
+        }
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+            fail( e.toString() );
+        }
+        assertNull( config );
+    }
+
+
+    public void testRetrieveAndBind()
+    {
+        log.debug( START_TEST );
+
+        ConfigurationDictionary configurationDictionary0 = createConfigurationDictionaryInstance( SOME_CN, SOME_PID_2,
+            SOME_FACTORY_PID );
+        try
+        {
+            configurationStore.update( configurationDictionary0 );
+        }
+        catch ( IOException e )
+        {
+            log.error( "Failed to update a configuration.", e );
+            fail( "Failed to Create an initial configuration. Because: " + e.toString() );
+
+        }
+
+        ConfigurationDictionary config = null;
+        try
+        {
+            config = configurationStore.retrieveAndBind( SOME_PID_2,SOME_BUNDLE_LOCATION );
+
+        }
+        catch ( ConfigurationException e )
+        {
+            e.printStackTrace();
+            fail( e.toString() );
+        }
+        assertNotNull( config );
+        assertEquals( SOME_PID_2, config.getServicePid() );
+        assertEquals( SOME_BUNDLE_LOCATION, config.getBundleLocation() );
+
+        config=null;
+        try
+        {
+            config = configurationStore.retrieveAndBind( SOME_PID_2,"bogus" );
+            fail( "Should have thrown a ConfigurationException after trying to get a bundle that was already bound.");
+        }
+        catch ( ConfigurationException e )
+        {
+           //expected
+            
+        }
+        assertNull( config );
+    }
+
+
+    public void testLoadAll()
+    {
+        log.debug( START_TEST );
+
+        ConfigurationDictionary configurationDictionary0 = createConfigurationDictionaryInstance( SOME_CN, SOME_PID_2,
+            SOME_FACTORY_PID_2 );
+        try
+        {
+            configurationStore.update( configurationDictionary0 );
+        }
+        catch ( IOException e )
+        {
+            log.error( "Failed to update a configuration.", e );
+            fail( "Failed to Create an initial configuration. Because: " + e.toString() );
+
+        }
+
+        ConfigurationDictionary[] configs = null;
+        try
+        {
+            configs = configurationStore.retrieveAll( SOME_FACTORY_PID_2 );
+        }
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+            fail( e.toString() );
+        }
+        assertNotNull( configs );
+        assertEquals( 1, configs.length );
+        ConfigurationDictionary config = configs[0];
+
+        assertEquals( SOME_PID_2, config.getServicePid() );
+    }
+
+
+    public void testListConfigurationsWithNullFilter()
+    {
+        log.debug( START_TEST );
+        ConfigurationDictionary configurationDictionary0 = createConfigurationDictionaryInstance( SOME_CN, SOME_PID_2,
+            SOME_FACTORY_PID );
+        try
+        {
+            configurationStore.update( configurationDictionary0 );
+        }
+        catch ( IOException e )
+        {
+            log.error( "Failed to update a configuration.", e );
+            fail( "Failed to Create an initial configuration. Because: " + e.toString() );
+
+        }
+
+        //Add second configuration to the store
+        ConfigurationDictionary configurationDictionary = createConfigurationDictionaryInstance( SOME_CN, SOME_PID_3,
+            SOME_FACTORY_PID );
+
+        try
+        {
+            configurationStore.update( configurationDictionary );
+        }
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+            fail( "Failed to Add second configuration to the store. Because: " + e.toString() );
+
+        }
+
+        String filter = null;
+        try
+        {
+            Configuration[] configs = configurationStore.listConfigurations( filter );
+            assertNotNull( configs );
+            assertEquals( 2, configs.length );
+        }
+        catch ( IOException e )
+        {
+            fail( e.toString() );
+        }
+        catch ( InvalidSyntaxException e )
+        {
+            fail( e.toString() );
+        }
+    }
+
+
+    /**
+     * 
+     * testListConfigurationsWithFilter
+     * 
+     *  Example filter: "(&(size=42)(service.factoryPid=*osgi*))"
+     *
+     */
+    public void testListConfigurationsWithFilter()
+    {
+        log.debug( START_TEST );
+        ConfigurationDictionary configurationDictionary0 = createConfigurationDictionaryInstance( SOME_CN, SOME_PID_2,
+            SOME_FACTORY_PID );
+        try
+        {
+            configurationStore.update( configurationDictionary0 );
+        }
+        catch ( IOException e )
+        {
+            log.error( "Failed to update a configuration.", e );
+            fail( "Failed to Create an initial configuration. Because: " + e.toString() );
+
+        }
+
+        //Add second configuration to the store
+        ConfigurationDictionary configurationDictionary = createConfigurationDictionaryInstance( SOME_CN, SOME_PID_3,
+            SOME_FACTORY_PID );
+
+        try
+        {
+            configurationStore.update( configurationDictionary );
+        }
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+            fail( "Failed to Add second configuration to the store. Because: " + e.toString() );
+
+        }
+        try
+        {
+            Configuration[] configs = configurationStore.listConfigurations( FILTER );
+            assertNotNull( configs );
+            assertEquals( 2, configs.length );
+        }
+        catch ( IOException e )
+        {
+            fail( e.toString() );
+        }
+        catch ( InvalidSyntaxException e )
+        {
+            fail( e.toString() );
+        }
+    }
+
+
+    public void testListConfigurationsWithBogusFilter()
+    {
+        log.debug( START_TEST );
+        String filter = "somebogusfilter";
+        try
+        {
+            configurationStore.listConfigurations( filter );
+            fail( "Expected an InvalidSytaxException." );
+        }
+        catch ( IOException e )
+        {
+            fail( e.toString() );
+        }
+        catch ( InvalidSyntaxException e )
+        {
+            //expected
+        }
+    }
+
+
+    public void testConfigurationStoreDelete()
+    {
+        log.debug( START_TEST );
+        ConfigurationDictionary configurationDictionary0 = createConfigurationDictionaryInstance( SOME_CN, SOME_PID_2,
+            SOME_FACTORY_PID );
+        try
+        {
+            configurationStore.update( configurationDictionary0 );
+        }
+        catch ( IOException e )
+        {
+            log.error( "Failed to update a configuration.", e );
+            fail( "Failed to Create an initial configuration. Because: " + e.toString() );
+
+        }
+
+        //Add second configuration to the store
+        ConfigurationDictionary configurationDictionary = createConfigurationDictionaryInstance( SOME_CN, SOME_PID_3,
+            SOME_FACTORY_PID );
+
+        try
+        {
+            configurationStore.update( configurationDictionary );
+        }
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+            fail( "Failed to Add second configuration to the store. Because: " + e.toString() );
+
+        }
+
+        ConfigurationDictionary dictionary = configurationDao.read( SOME_PID_2 );
+        assertNotNull( "missing entry", dictionary );
+
+        try
+        {
+            configurationStore.delete( SOME_PID_2 );
+        }
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+            fail( e.toString() );
+        }
+
+        dictionary = null;
+        try
+        {
+            dictionary = configurationDao.read( SOME_PID_2 );
+            fail( "Did not throw an exception." );
+        }
+        catch ( ConfigurationDaoException e )
+        {
+            //expected
+        }
+        assertNull( dictionary );
+        Set<String> pids = configurationStore.listPids();
+        assertNotNull( pids );
+        assertEquals( "Should be one pid from previous test", 1, pids.size() );
+        assertFalse( "Found deleted configuration in the store.", pids.contains( SOME_PID_2 ) );
+
+    }
+
+
+    public void testDeleteUnknown()
+    {
+        log.debug( START_TEST );
+        String servicePid = SOME_PID;
+        try
+        {
+            configurationStore.delete( servicePid );
+            fail( "Expected a IOException because the pid should be unknown." );
+        }
+        catch ( IOException e )
+        {
+            //expected
+        }
+
+    }
+
+
+    public void testGeneratePid()
+    {
+        log.debug( START_TEST );
+        String factoryPid = SOME_FACTORY_PID;
+        String servicePid = null;
+        try
+        {
+            servicePid = configurationStore.generatePid( factoryPid );
+        }
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+            fail( e.toString() );
+        }
+        assertNotNull( servicePid );
+        assertTrue( servicePid.startsWith( factoryPid ) );
+        log.debug( "Generated servicePid {} ", servicePid );
+    }
+
+
+    public void testDeleteAll()
+    {
+        log.debug( START_TEST );
+
+        try
+        {
+            configurationStore.deleteAll( SOME_FACTORY_PID );
+        }
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+            fail( e.toString() );
+        }
+
+        ConfigurationDictionary[] configs = null;
+        try
+        {
+            configs = configurationStore.retrieveAll( SOME_FACTORY_PID );
+        }
+        catch ( IOException e )
+        {
+
+            e.printStackTrace();
+            fail( e.toString() );
+        }
+        assertNotNull( configs );
+        assertTrue( "Should be empty", configs.length == 0 );
+    }
+
+
+    public void configurationChanged( ChangeType changeType, ConfigurationDictionary configurationDictionary )
+    {
+        this.changeType = changeType;
+        this.changedConfigurationDictionary = configurationDictionary;
+
+    }
+
+
+    private ConfigurationDictionary createConfigurationDictionaryInstance( String cn, String pid, String factory )
+    {
+        Vector<String> objectclass = new Vector<String>();
+        objectclass.add( "top" );
+        objectclass.add( ContextMapping.APACHEDS_SERVICE_CONFIGURATION_OBJECTCLASS );
+        Dictionary<String, Object> dictionary = new Hashtable<String, Object>();
+        dictionary.put( Constants.SERVICE_PID, pid );
+        if ( factory != null )
+        {
+            dictionary.put( ConfigurationAdmin.SERVICE_FACTORYPID, factory );
+        }
+        dictionary.put( "objectclass", objectclass );
+        dictionary.put( "cn", cn );
+
+        
+        ConfigurationDictionary configurationDictionary = new ConfigurationDictionary( dictionary );
+
+        return configurationDictionary;
+    }
+}

Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/impl/MockConfigurationTransformer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/impl/MockConfigurationTransformer.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/impl/MockConfigurationTransformer.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/impl/MockConfigurationTransformer.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,54 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+
+package org.apache.configuration.impl;
+
+
+import java.util.Dictionary;
+
+import org.apache.configuration.impl.ConfigurationDictionary;
+import org.apache.configuration.impl.ConfigurationTransformer;
+import org.osgi.framework.ServiceReference;
+
+
+/**
+ * MockConfigurationTransformer.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class MockConfigurationTransformer implements ConfigurationTransformer
+
+{
+    /**
+     * 
+     * Return the same dictionary
+     *
+     * @param serviceReference
+     * @param dictionary
+     * @return same dictionary
+     */
+    public Dictionary transform( ServiceReference serviceReference, ConfigurationDictionary dictionary )
+    {
+
+        return dictionary;
+    }
+
+}

Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/util/ApacheDSUtil.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/util/ApacheDSUtil.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/util/ApacheDSUtil.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/util/ApacheDSUtil.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,48 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+
+package org.apache.configuration.util;
+
+import java.io.File;
+
+/**
+ * ApacheDSUtil.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ApacheDSUtil
+{
+
+    public static boolean deleteDir(File dir) {
+        if (dir.isDirectory()) {
+            String[] children = dir.list();
+            for (int i=0; i<children.length; i++) {
+                boolean success = deleteDir(new File(dir, children[i]));
+                if (!success) {
+                    return false;
+                }
+            }
+        }
+        // The directory is now empty so delete it
+        return dir.delete();
+    }
+
+}

Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/event.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/event.xml?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/event.xml (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/event.xml Mon Jan 29 12:38:25 2007
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:osgi="http://www.springframework.org/schema/osgi"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+                      http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">
+
+
+	<bean id="configListeners"
+		class="org.springframework.beans.factory.config.ListFactoryBean">
+		<property name="sourceList">
+			<list>
+				<bean
+					class="org.apache.configuration.event.MockConfigurationListener" />
+			</list>
+		</property>
+	</bean>
+
+	<bean id="configurationTransformer"
+		class="org.apache.configuration.impl.MockConfigurationTransformer" />
+
+
+	<bean id="bundleContextFactory"
+		class="org.apache.configuration.springosgi.BundleContextFactory">
+		<property name="bundleContext">
+			<bean
+				class="org.springframework.osgi.mock.MockBundleContext">
+			</bean>
+		</property>
+	</bean>
+
+
+	<bean id="mockServiceReference"
+		class="org.springframework.osgi.mock.MockServiceReference">
+		<property name="properties">
+			<props>
+				<prop key="service.pid">some.pid</prop>
+			</props>
+		</property>
+	</bean>
+
+	<bean id="mockManagedServiceTrackingDelegate"
+		class="org.apache.configuration.event.MockManagedServiceTrackingDelegate">
+		<property name="serviceReference" ref="mockServiceReference" />
+	</bean>
+
+	<bean id="managedServiceTrackingAdapter"
+		class="org.apache.configuration.event.ManagedServiceTrackingAdapter"
+		init-method="init" destroy-method="destroy">
+		<property name="delegate" ref="mockManagedServiceTrackingDelegate"/> 
+		<property name="serviceTrackerCustomizer" ref="managedServiceTrackerCustomizer"/> 
+	</bean>
+	
+	
+
+    <!-- Set up ManagedServiceFactory dependents -->
+	<bean id="mockServiceFactoryReference"
+		class="org.springframework.osgi.mock.MockServiceReference">
+		<property name="properties">
+			<props>
+				<prop key="service.factoryPid">some.factory.pid</prop>
+
+			</props>
+		</property>
+	</bean>
+	
+	<bean id="mockManagedServiceFactoryTrackingDelegate"
+		class="org.apache.configuration.event.MockManagedServiceFactoryTrackingDelegate">
+		<property name="serviceReference"
+			ref="mockServiceFactoryReference" />
+	</bean>
+
+	<bean id="managedServiceFactoryTrackingAdapter"
+		class="org.apache.configuration.event.ManagedServiceFactoryTrackingAdapter"
+		init-method="init" destroy-method="destroy">
+		<property name="delegate" ref="mockManagedServiceFactoryTrackingDelegate"/> 
+	</bean>
+
+</beans>
\ No newline at end of file

Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/log4j.properties?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/log4j.properties (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/log4j.properties Mon Jan 29 12:38:25 2007
@@ -0,0 +1,33 @@
+#log4j.properties file
+# to debug this file add the vm argument 
+# -Dlog4j.debug=true
+
+# RootCategory all other categories inherit from this
+log4j.rootCategory=ERROR,console
+
+# Test infrastructure classes that use logging
+log4j.category.org.apache.directory.server.core.partition.impl.btree=ERROR
+#log4j.category.org.apache.directory.osgi.backend=DEBUG
+log4j.category.org.apache.directory.server.core=ERROR
+log4j.category.org.apache.directory.server.core.schema.bootstrap=ERROR
+#log4j.category.org.apache.directory.server.protocol.shared.store=DEBUG
+
+
+# Production classes that use logging
+log4j.category.org.apache.configuration.osgi.impl.ConfigurationAdminImpl=DEBUG
+log4j.category.org.apache.configuration.osgi.impl.ConfigurationAdminImplTest=DEBUG
+log4j.category.org.apache.configuration.osgi.impl.ConfigurationImplTest=INFO
+
+log4j.category.org.apache.configuration.dao.DaoConfigurationStore=DEBUG
+log4j.category.org.apache.configuration.dao.DaoConfigurationStoreTest=INFO
+
+log4j.category.org.apache.configuration.dao.jndi.impl.JndiConfigurationDaoNotifierImpl=ERROR
+#log4j.category.org.apache.configuration.dao.jndi.impl.IntegrationTest=ERROR
+#log4j.category.org.apache.configuration.dao.jndi.impl.UpdateDirCommand=ERROR 
+#log4j.category.org.apache.configuration.dao.jndi.impl.ListDirCommand=ERROR 
+
+# Console Appender
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.target=System.out
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%-5p  %l - %m%n
\ No newline at end of file

Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/logback.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/logback.xml?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/logback.xml (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/logback.xml Mon Jan 29 12:38:25 2007
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<configuration>
+	<appender name="console"
+		class="ch.qos.logback.core.ConsoleAppender">
+		<target>System.out</target>
+		<layout class="ch.qos.logback.classic.PatternLayout">
+			<pattern>%-5p %l - %m%n</pattern>
+		</layout>
+	</appender>
+	<logger name="org.apache.directory.server.core.schema.bootstrap">
+		<level value="ERROR" />
+	</logger>
+	<logger
+		name="org.apache.configuration.dao.DaoConfigurationStoreTest">
+		<level value="INFO" />
+	</logger>
+	<logger
+		name="org.apache.directory.server.core.partition.impl.btree">
+		<level value="ERROR" />
+	</logger>
+	<logger
+		name="org.apache.configuration.osgi.impl.ConfigurationAdminImplTest">
+		<level value="DEBUG" />
+	</logger>
+	<logger name="org.apache.configuration.dao.DaoConfigurationStore">
+		<level value="DEBUG" />
+	</logger>
+	<logger
+		name="org.apache.configuration.dao.jndi.impl.JndiConfigurationDaoNotifierImpl">
+		<level value="ERROR" />
+	</logger>
+	<logger
+		name="org.apache.configuration.osgi.impl.ConfigurationAdminImpl">
+		<level value="DEBUG" />
+	</logger>
+	<logger
+		name="org.apache.configuration.osgi.impl.ConfigurationImplTest">
+		<level value="INFO" />
+	</logger>
+	<logger name="org.apache.directory.server.core">
+		<level value="ERROR" />
+	</logger>
+	<root>
+		<level value="ERROR" />
+		<appender-ref ref="console" />
+	</root>
+</configuration>
\ No newline at end of file

Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/mockBundleContextFactory.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/mockBundleContextFactory.xml?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/mockBundleContextFactory.xml (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/mockBundleContextFactory.xml Mon Jan 29 12:38:25 2007
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+
+
+	 <bean id="bundleContextFactory" class="org.apache.configuration.spring.BundleContextFactory">
+		<property name="bundleContext">
+		   <bean class="org.springframework.osgi.mock.MockBundleContext">
+		   </bean>
+		</property>
+	</bean>
+   
+</beans>
+

Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/mockConfigurationDaoEventListener.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/mockConfigurationDaoEventListener.xml?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/mockConfigurationDaoEventListener.xml (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/mockConfigurationDaoEventListener.xml Mon Jan 29 12:38:25 2007
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+
+
+	
+    <bean id="configurationDaoEventListener" 
+    class="org.apache.configuration.event.MockConfigurationDaoListener"/>
+   
+   
+</beans>
+

Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/mockInitialContextFactory.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/mockInitialContextFactory.xml?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/mockInitialContextFactory.xml (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/mockInitialContextFactory.xml Mon Jan 29 12:38:25 2007
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+
+
+	<bean id="initialContextFactory"
+		class="org.apache.configuration.dao.jndi.impl.MockInitialContextFactory" destroy-method="cleanup"/>
+
+    <!--  <bean id="configurationDaoEventListener" class="org.apache.configuration.event.MockConfigurationDaoListener"/>-->
+   
+   
+</beans>
+



Mime
View raw message