You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2008/01/29 10:01:40 UTC
svn commit: r616219 - in /felix/trunk/configadmin/src:
main/java/org/apache/felix/cm/impl/ConfigurationAdapter.java
test/java/org/apache/felix/cm/file/FilePersistenceManagerConstructorTest.java
Author: cziegeler
Date: Tue Jan 29 01:01:39 2008
New Revision: 616219
URL: http://svn.apache.org/viewvc?rev=616219&view=rev
Log:
Correct license headers.
Modified:
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdapter.java
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/file/FilePersistenceManagerConstructorTest.java
Modified: felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdapter.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdapter.java?rev=616219&r1=616218&r2=616219&view=diff
==============================================================================
--- felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdapter.java (original)
+++ felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdapter.java Tue Jan 29 01:01:39 2008
@@ -1,16 +1,20 @@
-/*
- * $Url: $
- * $Id$
+/*
+ * 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
*
- * Copyright 1997-2005 Day Management AG
- * Barfuesserplatz 6, 4001 Basel, Switzerland
- * All Rights Reserved.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * This software is the confidential and proprietary information of
- * Day Management AG, ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Day.
+ * 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.felix.cm.impl;
Modified: felix/trunk/configadmin/src/test/java/org/apache/felix/cm/file/FilePersistenceManagerConstructorTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/test/java/org/apache/felix/cm/file/FilePersistenceManagerConstructorTest.java?rev=616219&r1=616218&r2=616219&view=diff
==============================================================================
--- felix/trunk/configadmin/src/test/java/org/apache/felix/cm/file/FilePersistenceManagerConstructorTest.java (original)
+++ felix/trunk/configadmin/src/test/java/org/apache/felix/cm/file/FilePersistenceManagerConstructorTest.java Tue Jan 29 01:01:39 2008
@@ -1,37 +1,29 @@
/*
- * $Url: $
- * $Id: $
+ * 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
*
- * Copyright 1997-2005 Day Management AG
- * Barfuesserplatz 6, 4001 Basel, Switzerland
- * All Rights Reserved.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * This software is the confidential and proprietary information of
- * Day Management AG, ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Day.
+ * 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.felix.cm.file;
import java.io.File;
-import java.io.InputStream;
-import java.util.Dictionary;
+
+import junit.framework.TestCase;
import org.apache.felix.cm.MockBundleContext;
-import org.apache.felix.cm.impl.ConfigurationManager;
-import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.BundleListener;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkListener;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-
-import junit.framework.TestCase;
/**
* The <code>FilePersistenceManagerConstructorTest</code> TODO
@@ -41,33 +33,33 @@
/** The current working directory for the tests */
private static final String TEST_WORKING_DIRECTORY = "target";
-
+
/** The Bundle Data Area directory for testing */
private static final String BUNDLE_DATA = "bundleData";
-
+
/** The Configuration location path for testing */
private static final String LOCATION_TEST = "test";
/** the previous working directory to return to on tearDown */
private String oldWorkingDirectory;
-
+
protected void setUp() throws Exception
{
super.setUp();
-
+
String testDir = new File(TEST_WORKING_DIRECTORY).getAbsolutePath();
-
+
oldWorkingDirectory = System.getProperty( "user.dir" );
System.setProperty( "user.dir", testDir );
}
-
+
protected void tearDown() throws Exception
{
System.setProperty( "user.dir", oldWorkingDirectory );
super.tearDown();
}
-
+
/**
* Test method for {@link org.apache.felix.cm.file.FilePersistenceManager#FilePersistenceManager(java.lang.String)}.
*/
@@ -77,16 +69,16 @@
FilePersistenceManager fpm;
String relPath;
String absPath;
-
+
// with null
fpm = new FilePersistenceManager(null);
assertFpm(fpm, new File(FilePersistenceManager.DEFAULT_CONFIG_DIR) );
-
+
// with a relative path
relPath = LOCATION_TEST;
fpm = new FilePersistenceManager(relPath);
assertFpm(fpm, new File(relPath) );
-
+
// with an absolute path
absPath = new File(LOCATION_TEST).getAbsolutePath();
fpm = new FilePersistenceManager(absPath);
@@ -105,55 +97,55 @@
String relPath;
String absPath;
File dataArea;
-
+
// first suite: no BundleContext at all
-
+
// with null
fpm = new FilePersistenceManager(null);
assertFpm(fpm, new File(FilePersistenceManager.DEFAULT_CONFIG_DIR) );
-
+
// with a relative path
relPath = LOCATION_TEST;
fpm = new FilePersistenceManager(relPath);
assertFpm(fpm, new File(relPath) );
-
+
// with an absolute path
absPath = new File(LOCATION_TEST).getAbsolutePath();
fpm = new FilePersistenceManager(absPath);
assertFpm(fpm, new File(absPath) );
-
-
+
+
// second suite: BundleContext without data file
bundleContext = new FilePersistenceManagerBundleContext(null);
-
+
// with null
fpm = new FilePersistenceManager(bundleContext, null);
assertFpm(fpm, new File(FilePersistenceManager.DEFAULT_CONFIG_DIR) );
-
+
// with a relative path
relPath = LOCATION_TEST;
fpm = new FilePersistenceManager(bundleContext, relPath);
assertFpm(fpm, new File(relPath) );
-
+
// with an absolute path
absPath = new File(LOCATION_TEST).getAbsolutePath();
fpm = new FilePersistenceManager(bundleContext, absPath);
assertFpm(fpm, new File(absPath) );
-
+
// third suite: BundleContext with relative data file
dataArea = new File(BUNDLE_DATA);
bundleContext = new FilePersistenceManagerBundleContext(dataArea);
-
+
// with null
fpm = new FilePersistenceManager(bundleContext, null);
assertFpm(fpm, new File(dataArea, FilePersistenceManager.DEFAULT_CONFIG_DIR) );
-
+
// with a relative path
relPath = LOCATION_TEST;
fpm = new FilePersistenceManager(bundleContext, relPath);
assertFpm(fpm, new File(dataArea, relPath) );
-
+
// with an absolute path
absPath = new File(LOCATION_TEST).getAbsolutePath();
fpm = new FilePersistenceManager(bundleContext, absPath);
@@ -162,36 +154,36 @@
// fourth suite: BundleContext with absolute data file
dataArea = new File(BUNDLE_DATA).getAbsoluteFile();
bundleContext = new FilePersistenceManagerBundleContext(dataArea);
-
+
// with null
fpm = new FilePersistenceManager(bundleContext, null);
assertFpm(fpm, new File(dataArea, FilePersistenceManager.DEFAULT_CONFIG_DIR) );
-
+
// with a relative path
relPath = LOCATION_TEST;
fpm = new FilePersistenceManager(bundleContext, relPath);
assertFpm(fpm, new File(dataArea, relPath) );
-
+
// with an absolute path
absPath = new File(LOCATION_TEST).getAbsolutePath();
fpm = new FilePersistenceManager(bundleContext, absPath);
assertFpm(fpm, new File(absPath) );
}
-
+
private void assertFpm(FilePersistenceManager fpm, File expected) {
assertEquals( expected.getAbsoluteFile(), fpm.getLocation() );
}
-
+
private static final class FilePersistenceManagerBundleContext extends MockBundleContext {
private File dataArea;
-
+
private FilePersistenceManagerBundleContext( File dataArea )
{
this.dataArea = dataArea;
}
-
+
public File getDataFile( String path )
{
return (dataArea != null) ? new File(dataArea, path) : null;