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 2018/05/11 13:02:40 UTC
svn commit: r1831408 - in
/felix/trunk/configadmin/src/test/java/org/apache/felix/cm: ./ file/ impl/
impl/helper/ impl/persistence/
Author: cziegeler
Date: Fri May 11 13:02:39 2018
New Revision: 1831408
URL: http://svn.apache.org/viewvc?rev=1831408&view=rev
Log:
Update tests to junit annotations
Modified:
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockBundle.java
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockBundleContext.java
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockLogService.java
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockNotCachablePersistenceManager.java
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockPersistenceManager.java
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockServiceReference.java
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/file/ConfigurationHandlerTest.java
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/file/FilePersistenceManagerConstructorTest.java
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/file/FilePersistenceManagerTest.java
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/CaseInsensitiveDictionaryTest.java
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/ConfigurationAdapterTest.java
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/DynamicBindingsTest.java
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/RankingComparatorTest.java
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/helper/ConfigurationMapTest.java
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/helper/TargetedPidTest.java
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/persistence/PersistenceManagerProxyTest.java
Modified: felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockBundle.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockBundle.java?rev=1831408&r1=1831407&r2=1831408&view=diff
==============================================================================
--- felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockBundle.java (original)
+++ felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockBundle.java Fri May 11 13:02:39 2018
@@ -51,7 +51,7 @@ public class MockBundle implements Bundl
@Override
- public Enumeration findEntries( String arg0, String arg1, boolean arg2 )
+ public Enumeration<URL> findEntries( String arg0, String arg1, boolean arg2 )
{
return null;
}
@@ -79,21 +79,21 @@ public class MockBundle implements Bundl
@Override
- public Enumeration getEntryPaths( String arg0 )
+ public Enumeration<String> getEntryPaths( String arg0 )
{
return null;
}
@Override
- public Dictionary getHeaders()
+ public Dictionary<String, String> getHeaders()
{
return null;
}
@Override
- public Dictionary getHeaders( String arg0 )
+ public Dictionary<String, String> getHeaders( String arg0 )
{
return null;
}
@@ -114,7 +114,7 @@ public class MockBundle implements Bundl
@Override
- public ServiceReference[] getRegisteredServices()
+ public ServiceReference<?>[] getRegisteredServices()
{
return null;
}
@@ -128,14 +128,14 @@ public class MockBundle implements Bundl
@Override
- public Enumeration getResources( String arg0 )
+ public Enumeration<URL> getResources( String arg0 )
{
return null;
}
@Override
- public ServiceReference[] getServicesInUse()
+ public ServiceReference<?>[] getServicesInUse()
{
return null;
}
@@ -163,7 +163,7 @@ public class MockBundle implements Bundl
@Override
- public Class loadClass( String arg0 ) throws ClassNotFoundException
+ public Class<?> loadClass( String arg0 ) throws ClassNotFoundException
{
throw new ClassNotFoundException( arg0 );
}
Modified: felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockBundleContext.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockBundleContext.java?rev=1831408&r1=1831407&r2=1831408&view=diff
==============================================================================
--- felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockBundleContext.java (original)
+++ felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockBundleContext.java Fri May 11 13:02:39 2018
@@ -70,6 +70,7 @@ public class MockBundleContext implement
* org.osgi.framework.BundleContext#addBundleListener(org.osgi.framework
* .BundleListener)
*/
+ @Override
public void addBundleListener( BundleListener arg0 )
{
}
@@ -81,6 +82,7 @@ public class MockBundleContext implement
* org.osgi.framework.BundleContext#addFrameworkListener(org.osgi.framework
* .FrameworkListener)
*/
+ @Override
public void addFrameworkListener( FrameworkListener arg0 )
{
}
@@ -92,6 +94,7 @@ public class MockBundleContext implement
* org.osgi.framework.BundleContext#addServiceListener(org.osgi.framework
* .ServiceListener)
*/
+ @Override
public void addServiceListener( ServiceListener arg0 )
{
}
@@ -103,6 +106,7 @@ public class MockBundleContext implement
* org.osgi.framework.BundleContext#addServiceListener(org.osgi.framework
* .ServiceListener, java.lang.String)
*/
+ @Override
public void addServiceListener( ServiceListener arg0, String arg1 )
{
}
@@ -112,6 +116,7 @@ public class MockBundleContext implement
* (non-Javadoc)
* @see org.osgi.framework.BundleContext#createFilter(java.lang.String)
*/
+ @Override
public Filter createFilter( String arg0 )
{
return null;
@@ -124,7 +129,8 @@ public class MockBundleContext implement
* org.osgi.framework.BundleContext#getAllServiceReferences(java.lang.String
* , java.lang.String)
*/
- public ServiceReference[] getAllServiceReferences( String arg0, String arg1 )
+ @Override
+ public ServiceReference<?>[] getAllServiceReferences( String arg0, String arg1 )
{
return null;
}
@@ -134,6 +140,7 @@ public class MockBundleContext implement
* (non-Javadoc)
* @see org.osgi.framework.BundleContext#getBundle()
*/
+ @Override
public Bundle getBundle()
{
return null;
@@ -144,6 +151,7 @@ public class MockBundleContext implement
* (non-Javadoc)
* @see org.osgi.framework.BundleContext#getBundle(long)
*/
+ @Override
public Bundle getBundle( long arg0 )
{
return null;
@@ -154,6 +162,7 @@ public class MockBundleContext implement
* (non-Javadoc)
* @see org.osgi.framework.BundleContext#getBundles()
*/
+ @Override
public Bundle[] getBundles()
{
return new Bundle[0];
@@ -164,6 +173,7 @@ public class MockBundleContext implement
* (non-Javadoc)
* @see org.osgi.framework.BundleContext#getDataFile(java.lang.String)
*/
+ @Override
public File getDataFile( String arg0 )
{
return null;
@@ -174,6 +184,7 @@ public class MockBundleContext implement
* (non-Javadoc)
* @see org.osgi.framework.BundleContext#getProperty(java.lang.String)
*/
+ @Override
public String getProperty( String name )
{
return properties.getProperty( name );
@@ -185,6 +196,7 @@ public class MockBundleContext implement
* @seeorg.osgi.framework.BundleContext#getService(org.osgi.framework.
* ServiceReference)
*/
+ @Override
public <S> S getService( ServiceReference<S> reference )
{
return null;
@@ -196,7 +208,8 @@ public class MockBundleContext implement
* @see
* org.osgi.framework.BundleContext#getServiceReference(java.lang.String)
*/
- public ServiceReference getServiceReference( String arg0 )
+ @Override
+ public ServiceReference<?> getServiceReference( String arg0 )
{
return null;
}
@@ -208,7 +221,8 @@ public class MockBundleContext implement
* org.osgi.framework.BundleContext#getServiceReferences(java.lang.String,
* java.lang.String)
*/
- public ServiceReference[] getServiceReferences( String arg0, String arg1 )
+ @Override
+ public ServiceReference<?>[] getServiceReferences( String arg0, String arg1 )
{
return null;
}
@@ -218,6 +232,7 @@ public class MockBundleContext implement
* (non-Javadoc)
* @see org.osgi.framework.BundleContext#installBundle(java.lang.String)
*/
+ @Override
public Bundle installBundle( String arg0 )
{
return null;
@@ -229,6 +244,7 @@ public class MockBundleContext implement
* @see org.osgi.framework.BundleContext#installBundle(java.lang.String,
* java.io.InputStream)
*/
+ @Override
public Bundle installBundle( String arg0, InputStream arg1 )
{
return null;
@@ -240,6 +256,7 @@ public class MockBundleContext implement
* @see org.osgi.framework.BundleContext#registerService(java.lang.String[],
* java.lang.Object, java.util.Dictionary)
*/
+ @Override
public ServiceRegistration<?> registerService( String[] clazzes, Object service, Dictionary<String, ?> properties )
{
return null;
@@ -251,6 +268,7 @@ public class MockBundleContext implement
* @see org.osgi.framework.BundleContext#registerService(java.lang.String,
* java.lang.Object, java.util.Dictionary)
*/
+ @Override
public ServiceRegistration<?> registerService( String clazz, Object service, Dictionary<String, ?> properties )
{
return null;
@@ -263,6 +281,7 @@ public class MockBundleContext implement
* org.osgi.framework.BundleContext#removeBundleListener(org.osgi.framework
* .BundleListener)
*/
+ @Override
public void removeBundleListener( BundleListener arg0 )
{
}
@@ -274,6 +293,7 @@ public class MockBundleContext implement
* org.osgi.framework.BundleContext#removeFrameworkListener(org.osgi.framework
* .FrameworkListener)
*/
+ @Override
public void removeFrameworkListener( FrameworkListener arg0 )
{
}
@@ -285,6 +305,7 @@ public class MockBundleContext implement
* org.osgi.framework.BundleContext#removeServiceListener(org.osgi.framework
* .ServiceListener)
*/
+ @Override
public void removeServiceListener( ServiceListener arg0 )
{
}
@@ -295,36 +316,42 @@ public class MockBundleContext implement
* @seeorg.osgi.framework.BundleContext#ungetService(org.osgi.framework.
* ServiceReference)
*/
+ @Override
public boolean ungetService( ServiceReference<?> reference )
{
return false;
}
+ @Override
public <S> ServiceRegistration<S> registerService( Class<S> clazz, S service, Dictionary<String, ?> properties )
{
return null;
}
+ @Override
public <S> ServiceReference<S> getServiceReference( Class<S> clazz )
{
return null;
}
+ @Override
public <S> Collection<ServiceReference<S>> getServiceReferences( Class<S> clazz, String filter )
{
return null;
}
+ @Override
public Bundle getBundle( String location )
{
return null;
}
+ @Override
public <S> ServiceRegistration<S> registerService(Class<S> clazz, ServiceFactory<S> factory,
Dictionary<String, ?> properties)
{
@@ -332,6 +359,7 @@ public class MockBundleContext implement
}
+ @Override
public <S> ServiceObjects<S> getServiceObjects(ServiceReference<S> reference)
{
return null;
Modified: felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockLogService.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockLogService.java?rev=1831408&r1=1831407&r2=1831408&view=diff
==============================================================================
--- felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockLogService.java (original)
+++ felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockLogService.java Fri May 11 13:02:39 2018
@@ -30,25 +30,29 @@ import org.osgi.service.log.LogService;
public class MockLogService implements LogService
{
+ @Override
public void log( int logLevel, String message )
{
System.err.print( toMessageLine( logLevel, message ) );
}
+ @Override
public void log( int logLevel, String message, Throwable t )
{
log( logLevel, message );
}
- public void log( ServiceReference ref, int logLevel, String message )
+ @Override
+ public void log( @SuppressWarnings("rawtypes") ServiceReference ref, int logLevel, String message )
{
log( logLevel, message );
}
- public void log( ServiceReference ref, int logLevel, String message, Throwable t )
+ @Override
+ public void log( @SuppressWarnings("rawtypes") ServiceReference ref, int logLevel, String message, Throwable t )
{
log( logLevel, message );
}
Modified: felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockNotCachablePersistenceManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockNotCachablePersistenceManager.java?rev=1831408&r1=1831407&r2=1831408&view=diff
==============================================================================
--- felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockNotCachablePersistenceManager.java (original)
+++ felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockNotCachablePersistenceManager.java Fri May 11 13:02:39 2018
@@ -30,9 +30,9 @@ import java.util.Map;
public class MockNotCachablePersistenceManager implements NotCachablePersistenceManager
{
- private final Map<String, Dictionary> configs = new HashMap<String, Dictionary>();
+ private final Map<String, Dictionary<String, Object>> configs = new HashMap<>();
- public Map<String, Dictionary> getStored()
+ public Map<String, Dictionary<String, Object>> getStored()
{
return configs;
}
@@ -51,6 +51,7 @@ public class MockNotCachablePersistenceM
}
+ @SuppressWarnings("rawtypes")
@Override
public Enumeration getDictionaries()
{
@@ -58,6 +59,7 @@ public class MockNotCachablePersistenceM
}
+ @SuppressWarnings("rawtypes")
@Override
public Dictionary load( String pid ) throws IOException
{
@@ -71,8 +73,9 @@ public class MockNotCachablePersistenceM
}
+ @SuppressWarnings("unchecked")
@Override
- public void store( String pid, Dictionary properties )
+ public void store( String pid, @SuppressWarnings("rawtypes") Dictionary properties )
{
configs.put( pid, properties );
}
Modified: felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockPersistenceManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockPersistenceManager.java?rev=1831408&r1=1831407&r2=1831408&view=diff
==============================================================================
--- felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockPersistenceManager.java (original)
+++ felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockPersistenceManager.java Fri May 11 13:02:39 2018
@@ -41,12 +41,14 @@ public class MockPersistenceManager impl
return configs.containsKey( pid );
}
+ @SuppressWarnings("rawtypes")
@Override
public Enumeration getDictionaries()
{
return Collections.enumeration( configs.values() );
}
+ @SuppressWarnings("rawtypes")
@Override
public Dictionary load( final String pid ) throws IOException
{
@@ -59,6 +61,7 @@ public class MockPersistenceManager impl
throw new IOException( "No such configuration: " + pid );
}
+ @SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void store( String pid, Dictionary properties )
{
Modified: felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockServiceReference.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockServiceReference.java?rev=1831408&r1=1831407&r2=1831408&view=diff
==============================================================================
--- felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockServiceReference.java (original)
+++ felix/trunk/configadmin/src/test/java/org/apache/felix/cm/MockServiceReference.java Fri May 11 13:02:39 2018
@@ -23,39 +23,45 @@ import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
-public class MockServiceReference implements ServiceReference
+public class MockServiceReference<S> implements ServiceReference<S>
{
+ @Override
public Object getProperty( String key )
{
return null;
}
+ @Override
public String[] getPropertyKeys()
{
return null;
}
+ @Override
public Bundle getBundle()
{
return null;
}
+ @Override
public Bundle[] getUsingBundles()
{
return null;
}
+ @Override
public boolean isAssignableTo( Bundle bundle, String className )
{
return false;
}
+ @Override
public int compareTo( Object reference )
{
return 0;
Modified: felix/trunk/configadmin/src/test/java/org/apache/felix/cm/file/ConfigurationHandlerTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/test/java/org/apache/felix/cm/file/ConfigurationHandlerTest.java?rev=1831408&r1=1831407&r2=1831408&view=diff
==============================================================================
--- felix/trunk/configadmin/src/test/java/org/apache/felix/cm/file/ConfigurationHandlerTest.java (original)
+++ felix/trunk/configadmin/src/test/java/org/apache/felix/cm/file/ConfigurationHandlerTest.java Fri May 11 13:02:39 2018
@@ -51,7 +51,8 @@ public class ConfigurationHandlerTest {
@Test
public void testComments() throws IOException
{
- final Dictionary dict = ConfigurationHandler.read(new ByteArrayInputStream(CONFIG.getBytes("UTF-8")));
+ @SuppressWarnings("unchecked")
+ final Dictionary<String, Object> dict = ConfigurationHandler.read(new ByteArrayInputStream(CONFIG.getBytes("UTF-8")));
Assert.assertEquals(2, dict.size());
Assert.assertEquals(VAL_1, dict.get(PAR_1));
Assert.assertEquals(VAL_2, dict.get(PAR_2).toString());
@@ -72,7 +73,7 @@ public class ConfigurationHandlerTest {
public void test_writeEmptyCollection() throws IOException {
OutputStream out = new ByteArrayOutputStream();
Dictionary< String, Object> properties = new Hashtable<>();
- properties.put(SERVICE_PID , new ArrayList());
+ properties.put(SERVICE_PID , new ArrayList<String>());
ConfigurationHandler.write(out, properties);
String entry = new String(((ByteArrayOutputStream)out).toByteArray(),"UTF-8");
Assert.assertEquals("service.pid=( \\\r\n)\r\n", entry);
@@ -82,10 +83,9 @@ public class ConfigurationHandlerTest {
public void test_writeCollection() throws IOException {
OutputStream out = new ByteArrayOutputStream();
Dictionary< String, Object> properties = new Hashtable<>();
- List list = new ArrayList<String>(){{
- add("foo");
- add("bar");
- }};
+ List<String> list = new ArrayList<>();
+ list.add("foo");
+ list.add("bar");
properties.put(SERVICE_PID , list);
ConfigurationHandler.write(out, properties);
@@ -197,7 +197,8 @@ public class ConfigurationHandlerTest {
public void test_readArray() throws IOException {
String entry = "service.pid=[ \\\r\n \"foo\", \\\r\n \"bar\", \\\r\n ]\r\n";
InputStream stream = new ByteArrayInputStream(entry.getBytes(StandardCharsets.UTF_8));
- Dictionary dictionary = ConfigurationHandler.read(stream);
+ @SuppressWarnings("unchecked")
+ Dictionary<String, Object> dictionary = ConfigurationHandler.read(stream);
Assert.assertEquals(1, dictionary.size());
Assert.assertArrayEquals(new String [] {"foo", "bar"}, (String [])dictionary.get(SERVICE_PID));
}
@@ -206,21 +207,22 @@ public class ConfigurationHandlerTest {
public void test_readEmptyCollection() throws IOException {
String entry = "service.pid=( \\\r\n)\r\n";
InputStream stream = new ByteArrayInputStream(entry.getBytes(StandardCharsets.UTF_8));
- Dictionary dictionary = ConfigurationHandler.read(stream);
+ @SuppressWarnings("unchecked")
+ Dictionary<String, Object> dictionary = ConfigurationHandler.read(stream);
Assert.assertEquals(1, dictionary.size());
- Assert.assertEquals(new ArrayList(), dictionary.get(SERVICE_PID));
+ Assert.assertEquals(new ArrayList<String>(), dictionary.get(SERVICE_PID));
}
@Test
public void test_readCollection() throws IOException {
String entry = "service.pid=( \\\r\n \"foo\", \\\r\n \"bar\", \\\r\n)\r\n";
InputStream stream = new ByteArrayInputStream(entry.getBytes(StandardCharsets.UTF_8));
- Dictionary dictionary = ConfigurationHandler.read(stream);
+ @SuppressWarnings("unchecked")
+ Dictionary<String, Object> dictionary = ConfigurationHandler.read(stream);
Assert.assertEquals(1, dictionary.size());
- List list = new ArrayList<String>(){{
- add("foo");
- add("bar");
- }};
+ List<String> list = new ArrayList<>();
+ list.add("foo");
+ list.add("bar");
Assert.assertEquals(list, dictionary.get(SERVICE_PID));
}
@@ -228,7 +230,8 @@ public class ConfigurationHandlerTest {
public void test_readSimpleString() throws IOException {
String entry = "service.pid=\"com.adobe.granite.foo.Bar\"\r\n";
InputStream stream = new ByteArrayInputStream(entry.getBytes(StandardCharsets.UTF_8));
- Dictionary dictionary = ConfigurationHandler.read(stream);
+ @SuppressWarnings("unchecked")
+ Dictionary<String, Object> dictionary = ConfigurationHandler.read(stream);
Assert.assertEquals(1, dictionary.size());
Assert.assertEquals( "com.adobe.granite.foo.Bar", dictionary.get(SERVICE_PID));
}
@@ -237,7 +240,8 @@ public class ConfigurationHandlerTest {
public void test_readSimpleStrings() throws IOException {
String entry = "service.pid=\"com.adobe.granite.foo.Bar\"\r\nfoo.bar=\"com.adobe.granite.foo.Baz\"\r\n";
InputStream stream = new ByteArrayInputStream(entry.getBytes(StandardCharsets.UTF_8));
- Dictionary dictionary = ConfigurationHandler.read(stream);
+ @SuppressWarnings("unchecked")
+ Dictionary<String, Object> dictionary = ConfigurationHandler.read(stream);
Assert.assertEquals(2, dictionary.size());
Assert.assertEquals( "com.adobe.granite.foo.Bar", dictionary.get(SERVICE_PID));
Assert.assertNotNull(dictionary.get("foo.bar"));
@@ -247,7 +251,8 @@ public class ConfigurationHandlerTest {
public void test_readInteger() throws IOException {
String entry = "service.pid=I\"1000\"\r\n";
InputStream stream = new ByteArrayInputStream(entry.getBytes(StandardCharsets.UTF_8));
- Dictionary dictionary = ConfigurationHandler.read(stream);
+ @SuppressWarnings("unchecked")
+ Dictionary<String, Object> dictionary = ConfigurationHandler.read(stream);
Assert.assertEquals(1, dictionary.size());
Assert.assertEquals( 1000, dictionary.get(SERVICE_PID));
}
@@ -256,7 +261,8 @@ public class ConfigurationHandlerTest {
public void test_readLong() throws IOException {
String entry = "service.pid=L\"1000\"\r\n";
InputStream stream = new ByteArrayInputStream(entry.getBytes(StandardCharsets.UTF_8));
- Dictionary dictionary = ConfigurationHandler.read(stream);
+ @SuppressWarnings("unchecked")
+ Dictionary<String, Object> dictionary = ConfigurationHandler.read(stream);
Assert.assertEquals(1, dictionary.size());
Assert.assertEquals( 1000L, dictionary.get(SERVICE_PID));
}
@@ -265,7 +271,8 @@ public class ConfigurationHandlerTest {
public void test_readFloat() throws IOException {
String entry = "service.pid=F\"1080452710\"\r\n";
InputStream stream = new ByteArrayInputStream(entry.getBytes(StandardCharsets.UTF_8));
- Dictionary dictionary = ConfigurationHandler.read(stream);
+ @SuppressWarnings("unchecked")
+ Dictionary<String, Object> dictionary = ConfigurationHandler.read(stream);
Assert.assertEquals(1, dictionary.size());
Assert.assertEquals( 3.6f, dictionary.get(SERVICE_PID));
}
@@ -274,7 +281,8 @@ public class ConfigurationHandlerTest {
public void test_readDouble() throws IOException {
String entry = "service.pid=D\"4615288898129284301\"\r\n";
InputStream stream = new ByteArrayInputStream(entry.getBytes(StandardCharsets.UTF_8));
- Dictionary dictionary = ConfigurationHandler.read(stream);
+ @SuppressWarnings("unchecked")
+ Dictionary<String, Object> dictionary = ConfigurationHandler.read(stream);
Assert.assertEquals(1, dictionary.size());
Assert.assertEquals( 3.6d, dictionary.get(SERVICE_PID));
}
@@ -283,7 +291,8 @@ public class ConfigurationHandlerTest {
public void test_readByte() throws IOException {
String entry = "service.pid=X\"10\"\r\n";
InputStream stream = new ByteArrayInputStream(entry.getBytes(StandardCharsets.UTF_8));
- Dictionary dictionary = ConfigurationHandler.read(stream);
+ @SuppressWarnings("unchecked")
+ Dictionary<String, Object> dictionary = ConfigurationHandler.read(stream);
Assert.assertEquals(1, dictionary.size());
Assert.assertEquals((byte)10 , dictionary.get(SERVICE_PID));
}
@@ -292,7 +301,8 @@ public class ConfigurationHandlerTest {
public void test_readShort() throws IOException {
String entry = "service.pid=S\"10\"\r\n";
InputStream stream = new ByteArrayInputStream(entry.getBytes(StandardCharsets.UTF_8));
- Dictionary dictionary = ConfigurationHandler.read(stream);
+ @SuppressWarnings("unchecked")
+ Dictionary<String, Object> dictionary = ConfigurationHandler.read(stream);
Assert.assertEquals(1, dictionary.size());
Assert.assertEquals((short)10 , dictionary.get(SERVICE_PID));
}
@@ -301,7 +311,8 @@ public class ConfigurationHandlerTest {
public void test_readChar() throws IOException {
String entry = "service.pid=C\"c\"\r\n";
InputStream stream = new ByteArrayInputStream(entry.getBytes(StandardCharsets.UTF_8));
- Dictionary dictionary = ConfigurationHandler.read(stream);
+ @SuppressWarnings("unchecked")
+ Dictionary<String, Object> dictionary = ConfigurationHandler.read(stream);
Assert.assertEquals(1, dictionary.size());
Assert.assertEquals('c' , dictionary.get(SERVICE_PID));
}
@@ -310,7 +321,8 @@ public class ConfigurationHandlerTest {
public void test_readBoolean() throws IOException {
String entry = "service.pid=B\"true\"\r\n";
InputStream stream = new ByteArrayInputStream(entry.getBytes(StandardCharsets.UTF_8));
- Dictionary dictionary = ConfigurationHandler.read(stream);
+ @SuppressWarnings("unchecked")
+ Dictionary<String, Object> dictionary = ConfigurationHandler.read(stream);
Assert.assertEquals(1, dictionary.size());
Assert.assertEquals(true , dictionary.get(SERVICE_PID));
}
@@ -324,6 +336,7 @@ public class ConfigurationHandlerTest {
ConfigurationHandler.write(out, dict);
try (final ByteArrayInputStream ins = new ByteArrayInputStream(out.toByteArray())) {
+ @SuppressWarnings("unchecked")
final Dictionary<String, Object> read = ConfigurationHandler.read(ins);
Assert.assertNotNull(read.get("key"));
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=1831408&r1=1831407&r2=1831408&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 Fri May 11 13:02:39 2018
@@ -18,14 +18,17 @@
*/
package org.apache.felix.cm.file;
-import java.io.File;
+import static org.junit.Assert.assertEquals;
-import junit.framework.TestCase;
+import java.io.File;
import org.apache.felix.cm.MockBundleContext;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.osgi.framework.BundleContext;
-public class FilePersistenceManagerConstructorTest extends TestCase
+public class FilePersistenceManagerConstructorTest
{
/** The current working directory for the tests */
@@ -40,26 +43,25 @@ public class FilePersistenceManagerConst
/** the previous working directory to return to on tearDown */
private String oldWorkingDirectory;
- protected void setUp() throws Exception
+ @Before
+ public 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
+ @After
+ public 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)}.
*/
+ @Test
public void testFilePersistenceManagerString()
{
// variables used in these tests
@@ -86,6 +88,7 @@ public class FilePersistenceManagerConst
/**
* Test method for {@link org.apache.felix.cm.file.FilePersistenceManager#FilePersistenceManager(org.osgi.framework.BundleContext, java.lang.String)}.
*/
+ @Test
public void testFilePersistenceManagerBundleContextString()
{
// variables used in these tests
@@ -181,6 +184,7 @@ public class FilePersistenceManagerConst
this.dataArea = dataArea;
}
+ @Override
public File getDataFile( String path )
{
return (dataArea != null) ? new File(dataArea, path) : null;
Modified: felix/trunk/configadmin/src/test/java/org/apache/felix/cm/file/FilePersistenceManagerTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/test/java/org/apache/felix/cm/file/FilePersistenceManagerTest.java?rev=1831408&r1=1831407&r2=1831408&view=diff
==============================================================================
--- felix/trunk/configadmin/src/test/java/org/apache/felix/cm/file/FilePersistenceManagerTest.java (original)
+++ felix/trunk/configadmin/src/test/java/org/apache/felix/cm/file/FilePersistenceManagerTest.java Fri May 11 13:02:39 2018
@@ -19,6 +19,11 @@
package org.apache.felix.cm.file;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
@@ -31,26 +36,24 @@ import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
-public class FilePersistenceManagerTest extends TestCase
+public class FilePersistenceManagerTest
{
private File file = new File( System.getProperty( "java.io.tmpdir" ), "config" );
private FilePersistenceManager fpm;
-
- protected void setUp() throws Exception
+ @Before
+ public void setUp() throws Exception
{
- super.setUp();
-
fpm = new FilePersistenceManager( file.getAbsolutePath() );
}
-
- protected void tearDown() throws Exception
+ @After
+ public void tearDown() throws Exception
{
File[] children = file.listFiles();
for ( int i = 0; children != null && i < children.length; i++ )
@@ -58,11 +61,9 @@ public class FilePersistenceManagerTest
children[i].delete();
}
file.delete();
-
- super.tearDown();
}
-
+ @Test
public void testPidPlain()
{
assertEquals( "plain", fpm.encodePid( "plain" ) );
@@ -75,6 +76,7 @@ public class FilePersistenceManagerTest
fpm.encodePid( "encode/ % /path" ) );
}
+ @Test
public void testPidEncodingCollision() {
// assert a == encode(a) ==> encode(a) == encode(encode(a))
final String plain = "plain";
@@ -91,6 +93,7 @@ public class FilePersistenceManagerTest
assertFalse( encode.equals( fpm.encodePid( fpm.encodePid( encode ) ) ) );
}
+ @Test
public void testPidDeviceNameEncodingWindows() {
// assert proper encoding of windows device file names (FELIX-4302)
String oldOsName = System.getProperty( "os.name" );
@@ -110,6 +113,7 @@ public class FilePersistenceManagerTest
}
}
+ @Test
public void testPidDeviceNameEncodingNonWindows() {
// assert no encoding of windows device file names (FELIX-4302)
String oldOsName = System.getProperty( "os.name" );
@@ -129,12 +133,14 @@ public class FilePersistenceManagerTest
}
}
+ @Test
public void testCreateDir()
{
assertTrue( file.isDirectory() );
}
+ @Test
public void testSimple() throws IOException
{
check( "String", "String Value" );
@@ -149,6 +155,7 @@ public class FilePersistenceManagerTest
}
+ @Test
public void testQuoting() throws IOException
{
check( "QuotingSeparators", "\\()[]{}.,=\"\"''" );
@@ -158,6 +165,7 @@ public class FilePersistenceManagerTest
}
+ @Test
public void testArray() throws IOException
{
check( "StringArray", new String[]
@@ -169,6 +177,7 @@ public class FilePersistenceManagerTest
}
+ @Test
public void testEmptyArray() throws IOException
{
check( "StringArray", new String[0] );
@@ -178,24 +187,27 @@ public class FilePersistenceManagerTest
}
+ @Test
public void testVector() throws IOException
{
- check( "StringVector", new Vector( Arrays.asList( new String[]
+ check( "StringVector", new Vector<>( Arrays.asList( new String[]
{ "one", "two", "three" } ) ) );
- check( "IntegerVector", new Vector( Arrays.asList( new Integer[]
+ check( "IntegerVector", new Vector<>( Arrays.asList( new Integer[]
{ new Integer( 0 ), new Integer( 1 ), new Integer( 2 ) } ) ) );
}
+ @Test
public void testEmptyVector() throws IOException
{
- check( "StringArray", new Vector() );
- check( "IntArray", new Vector() );
- check( "CharArray", new Vector() );
- check( "ShortArray", new Vector() );
+ check( "StringArray", new Vector<String>() );
+ check( "IntArray", new Vector<Integer>() );
+ check( "CharArray", new Vector<Character>() );
+ check( "ShortArray", new Vector<Short>() );
}
+ @Test
public void testList() throws IOException
{
check( "StringList", Arrays.asList( new String[]
@@ -205,18 +217,20 @@ public class FilePersistenceManagerTest
}
+ @Test
public void testEmptyList() throws IOException
{
- check( "StringArray", new ArrayList(0) );
- check( "IntArray", new ArrayList(0) );
- check( "CharArray", new ArrayList(0) );
- check( "ShortArray", new ArrayList(0) );
+ check( "StringArray", new ArrayList<String>(0) );
+ check( "IntArray", new ArrayList<Integer>(0) );
+ check( "CharArray", new ArrayList<Character>(0) );
+ check( "ShortArray", new ArrayList<Short>(0) );
}
+ @Test
public void testMultiValue() throws IOException
{
- Dictionary props = new Hashtable();
+ Dictionary<String, Object> props = new Hashtable<>();
props.put( "String", "String Value" );
props.put( "Integer", new Integer( 2 ) );
props.put( "Long", new Long( 2 ) );
@@ -235,6 +249,7 @@ public class FilePersistenceManagerTest
// test configuration keys not conforming to the recommended specification
// for configuration keys in OSGi CM 1.3, 104.4.2, Configuration Properties
+ @Test
public void testNonSpecKeys() throws IOException {
check( "with\ttab", "the value" );
check( "with blank", "the value" );
@@ -247,6 +262,7 @@ public class FilePersistenceManagerTest
// Test expected to always succeed on non-Windows platforms. It may
// break if FilePersistenceManager.encode does not cope properly
// with Windows device names (see FELIX-4302)
+ @Test
public void testWindowsSpecialNames() throws IOException
{
check( "prefixLPT1", "lpt1" );
@@ -256,9 +272,10 @@ public class FilePersistenceManagerTest
check( "LPT1", "lpt1" );
}
+ @Test
public void testKeyOrderInFile() throws IOException
{
- Dictionary props = new Hashtable();
+ Dictionary<String, Object> props = new Hashtable<>();
// The following keys are stored as "c, a, b" in HashTable based
// due to their hash code
props.put( "a_first", "a" );
@@ -273,11 +290,11 @@ public class FilePersistenceManagerTest
try
{
String previousLine = breader.readLine();
- while ( previousLine != null)
+ while ( previousLine != null)
{
String line = breader.readLine();
if (line != null) {
- Assert.assertTrue( previousLine.compareTo( line ) < 0 );
+ assertTrue( previousLine.compareTo( line ) < 0 );
}
previousLine = line;
}
@@ -290,26 +307,27 @@ public class FilePersistenceManagerTest
private void check( String name, Object value ) throws IOException
{
- Dictionary props = new Hashtable();
+ Dictionary<String, Object> props = new Hashtable<>();
props.put( name, value );
check( name, props );
}
- private void check( String pid, Dictionary props ) throws IOException
+ private void check( String pid, Dictionary<String, Object> props ) throws IOException
{
fpm.store( pid, props );
assertTrue( new File( file, fpm.encodePid( pid ) + ".config" ).exists() );
- Dictionary loaded = fpm.load( pid );
+ @SuppressWarnings("unchecked")
+ Dictionary<String, Object> loaded = fpm.load( pid );
assertNotNull( loaded );
assertEquals( props.size(), loaded.size() );
- for ( Enumeration pe = props.keys(); pe.hasMoreElements(); )
+ for ( Enumeration<String> pe = props.keys(); pe.hasMoreElements(); )
{
- String key = ( String ) pe.nextElement();
+ String key = pe.nextElement();
checkValues( props.get( key ), loaded.get( key ) );
}
}
Modified: felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/CaseInsensitiveDictionaryTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/CaseInsensitiveDictionaryTest.java?rev=1831408&r1=1831407&r2=1831408&view=diff
==============================================================================
--- felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/CaseInsensitiveDictionaryTest.java (original)
+++ felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/CaseInsensitiveDictionaryTest.java Fri May 11 13:02:39 2018
@@ -19,6 +19,10 @@
package org.apache.felix.cm.impl;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -26,12 +30,13 @@ import java.util.List;
import java.util.Locale;
import java.util.Vector;
-import junit.framework.TestCase;
+import org.junit.Test;
-public class CaseInsensitiveDictionaryTest extends TestCase
+public class CaseInsensitiveDictionaryTest
{
+ @Test
public void testLocaleIndependence() {
Locale defaultLocal = Locale.getDefault();
CaseInsensitiveDictionary dict = new CaseInsensitiveDictionary();
@@ -54,6 +59,7 @@ public class CaseInsensitiveDictionaryTe
}
+ @Test
public void testCheckValueNull()
{
// null which must throw IllegalArgumentException
@@ -70,6 +76,7 @@ public class CaseInsensitiveDictionaryTe
}
+ @Test
public void testCheckValueSimple()
{
internalTestCheckValue( "String" );
@@ -84,6 +91,7 @@ public class CaseInsensitiveDictionaryTe
}
+ @Test
public void testCheckValueSimpleArray()
{
internalTestCheckValue( new String[]
@@ -107,6 +115,7 @@ public class CaseInsensitiveDictionaryTe
}
+ @Test
public void testCheckValuePrimitiveArray()
{
internalTestCheckValue( new long[]
@@ -128,64 +137,73 @@ public class CaseInsensitiveDictionaryTe
}
+ @Test
public void testCheckValueSimpleVector()
{
- internalTestCheckValue( "String", Vector.class );
- internalTestCheckValue( new Integer( 1 ), Vector.class );
- internalTestCheckValue( new Long( 1 ), Vector.class );
- internalTestCheckValue( new Float( 1 ), Vector.class );
- internalTestCheckValue( new Double( 1 ), Vector.class );
- internalTestCheckValue( new Byte( ( byte ) 1 ), Vector.class );
- internalTestCheckValue( new Short( ( short ) 1 ), Vector.class );
- internalTestCheckValue( new Character( 'a' ), Vector.class );
- internalTestCheckValue( Boolean.TRUE, Vector.class );
+ internalTestCheckValueVector( "String", String.class );
+ internalTestCheckValueVector( new Integer( 1 ), Integer.class );
+ internalTestCheckValueVector( new Long( 1 ), Long.class );
+ internalTestCheckValueVector( new Float( 1 ), Float.class );
+ internalTestCheckValueVector( new Double( 1 ), Double.class );
+ internalTestCheckValueVector( new Byte( ( byte ) 1 ), Byte.class );
+ internalTestCheckValueVector( new Short( ( short ) 1 ), Short.class );
+ internalTestCheckValueVector( new Character( 'a' ), Character.class );
+ internalTestCheckValueVector( Boolean.TRUE, Boolean.class );
}
-
+ @Test
public void testCheckValueSimpleSet()
{
- internalTestCheckValue( "String", HashSet.class );
- internalTestCheckValue( new Integer( 1 ), HashSet.class );
- internalTestCheckValue( new Long( 1 ), HashSet.class );
- internalTestCheckValue( new Float( 1 ), HashSet.class );
- internalTestCheckValue( new Double( 1 ), HashSet.class );
- internalTestCheckValue( new Byte( ( byte ) 1 ), HashSet.class );
- internalTestCheckValue( new Short( ( short ) 1 ), HashSet.class );
- internalTestCheckValue( new Character( 'a' ), HashSet.class );
- internalTestCheckValue( Boolean.TRUE, HashSet.class );
+ internalTestCheckValueSet( "String", String.class );
+ internalTestCheckValueSet( new Integer( 1 ), Integer.class );
+ internalTestCheckValueSet( new Long( 1 ), Long.class );
+ internalTestCheckValueSet( new Float( 1 ), Float.class );
+ internalTestCheckValueSet( new Double( 1 ), Double.class );
+ internalTestCheckValueSet( new Byte( ( byte ) 1 ), Byte.class );
+ internalTestCheckValueSet( new Short( ( short ) 1 ), Short.class );
+ internalTestCheckValueSet( new Character( 'a' ), Character.class );
+ internalTestCheckValueSet( Boolean.TRUE, Boolean.class );
}
+ @Test
public void testCheckValueSimpleArrayList()
{
- internalTestCheckValue( "String", ArrayList.class );
- internalTestCheckValue( new Integer( 1 ), ArrayList.class );
- internalTestCheckValue( new Long( 1 ), ArrayList.class );
- internalTestCheckValue( new Float( 1 ), ArrayList.class );
- internalTestCheckValue( new Double( 1 ), ArrayList.class );
- internalTestCheckValue( new Byte( ( byte ) 1 ), ArrayList.class );
- internalTestCheckValue( new Short( ( short ) 1 ), ArrayList.class );
- internalTestCheckValue( new Character( 'a' ), ArrayList.class );
- internalTestCheckValue( Boolean.TRUE, ArrayList.class );
+ internalTestCheckValueList( "String", String.class );
+ internalTestCheckValueList( new Integer( 1 ), Integer.class );
+ internalTestCheckValueList( new Long( 1 ), Long.class );
+ internalTestCheckValueList( new Float( 1 ), Float.class );
+ internalTestCheckValueList( new Double( 1 ), Double.class );
+ internalTestCheckValueList( new Byte( ( byte ) 1 ), Byte.class );
+ internalTestCheckValueList( new Short( ( short ) 1 ), Short.class );
+ internalTestCheckValueList( new Character( 'a' ), Character.class );
+ internalTestCheckValueList( Boolean.TRUE, Boolean.class );
}
- private void internalTestCheckValue( Object value, Class collectionType )
+ private <T> void internalTestCheckValueList( T value, Class<T> collectionType )
{
- Collection coll;
- try
- {
- coll = ( Collection ) collectionType.newInstance();
- }
- catch ( Throwable t )
- {
- throw new IllegalArgumentException( collectionType + " cannot be instantiated as a Collection" );
- }
+ Collection<T> coll = new ArrayList<>();
coll.add( value );
internalTestCheckValue( coll );
}
+ private <T> void internalTestCheckValueVector( T value, Class<T> collectionType )
+ {
+ Collection<T> coll = new Vector<>();
+
+ coll.add( value );
+ internalTestCheckValue( coll );
+ }
+
+ private <T> void internalTestCheckValueSet( T value, Class<T> collectionType )
+ {
+ Collection<T> coll = new HashSet<>();
+
+ coll.add( value );
+ internalTestCheckValue( coll );
+ }
private void internalTestCheckValue( Object value )
{
@@ -197,8 +215,8 @@ public class CaseInsensitiveDictionaryTe
{
if ( ( expected instanceof Collection ) && ( actual instanceof Collection ) )
{
- Collection eColl = ( Collection ) expected;
- Collection aColl = ( Collection ) actual;
+ Collection<?> eColl = ( Collection<?> ) expected;
+ Collection<?> aColl = ( Collection<?> ) actual;
if ( eColl.size() != aColl.size() )
{
fail( "Unexpected size. expected:" + eColl.size() + ", actual: " + aColl.size() );
@@ -207,7 +225,7 @@ public class CaseInsensitiveDictionaryTe
// create a list from the expected collection and remove
// all values from the actual collection, this should get
// an empty collection
- List eList = new ArrayList( eColl );
+ List<?> eList = new ArrayList<>( eColl );
eList.removeAll( aColl );
assertTrue( "Collections do not match. expected:" + eColl + ", actual: " + aColl, eList.isEmpty() );
}
@@ -218,6 +236,7 @@ public class CaseInsensitiveDictionaryTe
}
+ @Test
public void testValidKeys()
{
CaseInsensitiveDictionary.checkKey( "a" );
@@ -231,6 +250,7 @@ public class CaseInsensitiveDictionaryTe
}
+ @Test
public void testKeyDots()
{
// FELIX-2184 these keys are all valid (but not recommended)
@@ -243,7 +263,7 @@ public class CaseInsensitiveDictionaryTe
CaseInsensitiveDictionary.checkKey( ".a.b.c" );
}
-
+ @Test
public void testKeyIllegalCharacters()
{
testFailingKey( null );
Modified: felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/ConfigurationAdapterTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/ConfigurationAdapterTest.java?rev=1831408&r1=1831407&r2=1831408&view=diff
==============================================================================
--- felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/ConfigurationAdapterTest.java (original)
+++ felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/ConfigurationAdapterTest.java Fri May 11 13:02:39 2018
@@ -50,7 +50,7 @@ public class ConfigurationAdapterTest
private final String[] ARRAY_VALUE;
private static final String COLLECTION = "collection";
- private final Collection COLLECTION_VALUE;
+ private final Collection<String> COLLECTION_VALUE;
private static final String TEST_PID = "test.pid";
private static final String TEST_LOCATION = "test:location";
@@ -60,7 +60,7 @@ public class ConfigurationAdapterTest
{
ARRAY_VALUE = new String[]
{ STRING_VALUE };
- COLLECTION_VALUE = new ArrayList();
+ COLLECTION_VALUE = new ArrayList<>();
COLLECTION_VALUE.add( STRING_VALUE );
}
@@ -78,14 +78,14 @@ public class ConfigurationAdapterTest
@Test public void testScalar() throws IOException
{
Configuration cimpl = getConfiguration();
- Dictionary props = cimpl.getProperties();
+ Dictionary<String, Object> props = cimpl.getProperties();
assertNull( "Configuration is fresh", props );
- props = new Hashtable();
+ props = new Hashtable<>();
props.put( SCALAR, STRING_VALUE );
cimpl.update( props );
- Dictionary newProps = cimpl.getProperties();
+ Dictionary<String, Object> newProps = cimpl.getProperties();
assertNotNull( "Configuration is not fresh", newProps );
assertEquals( "Expect 2 elements", 2, newProps.size() );
assertEquals( "Service.pid must match", TEST_PID, newProps.get( Constants.SERVICE_PID ) );
@@ -97,14 +97,14 @@ public class ConfigurationAdapterTest
{
Configuration cimpl = getConfiguration();
- Dictionary props = cimpl.getProperties();
+ Dictionary<String, Object> props = cimpl.getProperties();
assertNull( "Configuration is fresh", props );
- props = new Hashtable();
+ props = new Hashtable<>();
props.put( ARRAY, ARRAY_VALUE );
cimpl.update( props );
- Dictionary newProps = cimpl.getProperties();
+ Dictionary<String, Object> newProps = cimpl.getProperties();
assertNotNull( "Configuration is not fresh", newProps );
assertEquals( "Expect 2 elements", 2, newProps.size() );
assertEquals( "Service.pid must match", TEST_PID, newProps.get( Constants.SERVICE_PID ) );
@@ -119,7 +119,7 @@ public class ConfigurationAdapterTest
Array.set( testProp, 0, STRING_VALUE2 );
// the array element change must not be reflected in the configuration
- Dictionary newProps2 = cimpl.getProperties();
+ Dictionary<String, Object> newProps2 = cimpl.getProperties();
Object testProp2 = newProps2.get( ARRAY );
assertNotNull( testProp2 );
assertTrue( testProp2.getClass().isArray() );
@@ -128,18 +128,19 @@ public class ConfigurationAdapterTest
}
+ @SuppressWarnings("unchecked")
@Test public void testCollection() throws IOException
{
Configuration cimpl = getConfiguration();
- Dictionary props = cimpl.getProperties();
+ Dictionary<String, Object> props = cimpl.getProperties();
assertNull( "Configuration is fresh", props );
- props = new Hashtable();
+ props = new Hashtable<>();
props.put( COLLECTION, COLLECTION_VALUE );
cimpl.update( props );
- Dictionary newProps = cimpl.getProperties();
+ Dictionary<String, Object> newProps = cimpl.getProperties();
assertNotNull( "Configuration is not fresh", newProps );
assertEquals( "Expect 2 elements", 2, newProps.size() );
assertEquals( "Service.pid must match", TEST_PID, newProps.get( Constants.SERVICE_PID ) );
@@ -147,7 +148,7 @@ public class ConfigurationAdapterTest
Object testProp = newProps.get( COLLECTION );
assertNotNull( testProp );
assertTrue( testProp instanceof Collection );
- Collection coll = ( Collection ) testProp;
+ Collection<String> coll = ( Collection<String> ) testProp;
assertEquals( 1, coll.size() );
assertEquals( STRING_VALUE, coll.iterator().next() );
@@ -156,11 +157,11 @@ public class ConfigurationAdapterTest
coll.add( STRING_VALUE2 );
// the array element change must not be reflected in the configuration
- Dictionary newProps2 = cimpl.getProperties();
+ Dictionary<String, Object> newProps2 = cimpl.getProperties();
Object testProp2 = newProps2.get( COLLECTION );
assertNotNull( testProp2 );
assertTrue( testProp2 instanceof Collection );
- Collection coll2 = ( Collection ) testProp2;
+ Collection<String> coll2 = ( Collection<String> ) testProp2;
assertEquals( 1, coll2.size() );
assertEquals( STRING_VALUE, coll2.iterator().next() );
}
Modified: felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/DynamicBindingsTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/DynamicBindingsTest.java?rev=1831408&r1=1831407&r2=1831408&view=diff
==============================================================================
--- felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/DynamicBindingsTest.java (original)
+++ felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/DynamicBindingsTest.java Fri May 11 13:02:39 2018
@@ -19,21 +19,28 @@
package org.apache.felix.cm.impl;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.Dictionary;
-import junit.framework.TestCase;
-
import org.apache.felix.cm.MockBundle;
import org.apache.felix.cm.MockBundleContext;
import org.apache.felix.cm.file.FilePersistenceManager;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
-public class DynamicBindingsTest extends TestCase
+public class DynamicBindingsTest
{
private File configLocation;
@@ -44,34 +51,26 @@ public class DynamicBindingsTest extends
private static final String PID1 = "test.pid.1";
- private static final String PID2 = "test.pid.2";
-
private static final String LOCATION1 = "test://location.1";
- private static final String LOCATION2 = "test://location.2";
-
-
- protected void setUp() throws Exception
+ @Before
+ public void setUp() throws Exception
{
- super.setUp();
-
configLocation = new File( "target/config." + System.currentTimeMillis() );
persistenceManager = new FilePersistenceManager( configLocation.getAbsolutePath() );
bindingsFile = new File( configLocation, DynamicBindings.BINDINGS_FILE_NAME + ".config" );
}
-
- protected void tearDown() throws Exception
+ @After
+ public void tearDown() throws Exception
{
bindingsFile.delete();
configLocation.delete();
-
- super.tearDown();
}
- public void test_no_bindings() throws IOException
+ @Test public void test_no_bindings() throws IOException
{
// ensure there is no file
@@ -79,14 +78,14 @@ public class DynamicBindingsTest extends
final BundleContext ctx = new MockBundleContext();
final DynamicBindings dm = new DynamicBindings( ctx, persistenceManager );
- final Dictionary bindings = getBindings( dm );
+ final Dictionary<String, Object> bindings = getBindings( dm );
assertNotNull( bindings );
assertTrue( bindings.isEmpty() );
}
- public void test_store_bindings() throws IOException
+ @Test public void test_store_bindings() throws IOException
{
// ensure there is no file
bindingsFile.delete();
@@ -99,14 +98,15 @@ public class DynamicBindingsTest extends
assertTrue( bindingsFile.exists() );
- final Dictionary bindings = persistenceManager.load( DynamicBindings.BINDINGS_FILE_NAME );
+ @SuppressWarnings("unchecked")
+ final Dictionary<String, Object> bindings = persistenceManager.load( DynamicBindings.BINDINGS_FILE_NAME );
assertNotNull( bindings );
assertEquals( 1, bindings.size() );
assertEquals( LOCATION1, bindings.get( PID1 ) );
}
- public void test_store_and_load_bindings() throws IOException
+ @Test public void test_store_and_load_bindings() throws IOException
{
// ensure there is no file
bindingsFile.delete();
@@ -123,14 +123,14 @@ public class DynamicBindingsTest extends
assertEquals( LOCATION1, dm.getLocation( PID1 ) );
// low level check
- final Dictionary bindings = getBindings( dm );
+ final Dictionary<String, Object> bindings = getBindings( dm );
assertNotNull( bindings );
assertEquals( 1, bindings.size() );
assertEquals( LOCATION1, bindings.get( PID1 ) );
}
- public void test_store_and_load_bindings_with_cleanup() throws IOException
+ @Test public void test_store_and_load_bindings_with_cleanup() throws IOException
{
// ensure there is no file
bindingsFile.delete();
@@ -146,19 +146,20 @@ public class DynamicBindingsTest extends
assertNull( dm.getLocation( PID1 ) );
// low level check
- final Dictionary bindings = getBindings( dm );
+ final Dictionary<String, Object> bindings = getBindings( dm );
assertNotNull( bindings );
assertTrue( bindings.isEmpty() );
}
- private static Dictionary getBindings( DynamicBindings dm )
+ @SuppressWarnings("unchecked")
+ private static Dictionary<String, Object> getBindings( DynamicBindings dm )
{
try
{
final Field bindings = dm.getClass().getDeclaredField( "bindings" );
bindings.setAccessible( true );
- return ( Dictionary ) bindings.get( dm );
+ return ( Dictionary<String, Object> ) bindings.get( dm );
}
catch ( Throwable t )
{
@@ -169,6 +170,7 @@ public class DynamicBindingsTest extends
private static class DMTestMockBundleContext extends MockBundleContext
{
+ @Override
public Bundle[] getBundles()
{
return new Bundle[]
Modified: felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/RankingComparatorTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/RankingComparatorTest.java?rev=1831408&r1=1831407&r2=1831408&view=diff
==============================================================================
--- felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/RankingComparatorTest.java (original)
+++ felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/RankingComparatorTest.java Fri May 11 13:02:39 2018
@@ -19,6 +19,9 @@
package org.apache.felix.cm.impl;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
@@ -27,22 +30,21 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
+import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
import org.osgi.service.cm.ConfigurationPlugin;
-import junit.framework.TestCase;
-
-public class RankingComparatorTest extends TestCase
+public class RankingComparatorTest
{
private final Comparator<ServiceReference<?>> srvRank = RankingComparator.SRV_RANKING;
private final Comparator<ServiceReference<?>> cmRank = RankingComparator.CM_RANKING;
- public void test_service_ranking_no_property()
+ @Test public void test_service_ranking_no_property()
{
ServiceReference<?> r1 = new MockServiceReference().setProperty( Constants.SERVICE_RANKING, null );
ServiceReference<?> r2 = new MockServiceReference().setProperty( Constants.SERVICE_RANKING, null );
@@ -74,7 +76,7 @@ public class RankingComparatorTest exten
}
- public void test_service_ranking_property()
+ @Test public void test_service_ranking_property()
{
ServiceReference<?> r1 = new MockServiceReference().setProperty( Constants.SERVICE_RANKING, new Integer( 100 ) );
ServiceReference<?> r2 = new MockServiceReference().setProperty( Constants.SERVICE_RANKING, new Integer( -100 ) );
@@ -94,7 +96,7 @@ public class RankingComparatorTest exten
}
- public void test_service_cm_ranking_property()
+ @Test public void test_service_cm_ranking_property()
{
ServiceReference<?> r1 = new MockServiceReference()
.setProperty( ConfigurationPlugin.CM_RANKING, new Integer( 100 ) );
@@ -116,7 +118,7 @@ public class RankingComparatorTest exten
}
- public void test_service_ranking_sort()
+ @Test public void test_service_ranking_sort()
{
ServiceReference<?> r1 = new MockServiceReference().setProperty( Constants.SERVICE_RANKING, new Integer( 100 ) );
ServiceReference<?> r2 = new MockServiceReference().setProperty( Constants.SERVICE_RANKING, new Integer( -100 ) );
@@ -136,13 +138,13 @@ public class RankingComparatorTest exten
}
- public void test_service_ranking_set()
+ @Test public void test_service_ranking_set()
{
ServiceReference<?> r1 = new MockServiceReference().setProperty( Constants.SERVICE_RANKING, new Integer( 100 ) );
ServiceReference<?> r2 = new MockServiceReference().setProperty( Constants.SERVICE_RANKING, new Integer( -100 ) );
ServiceReference<?> r3 = new MockServiceReference().setProperty( Constants.SERVICE_RANKING, null );
- Set<ServiceReference<?>> refSet = new TreeSet<ServiceReference<?>>( srvRank );
+ Set<ServiceReference<?>> refSet = new TreeSet<>( srvRank );
refSet.add( r1 );
refSet.add( r2 );
refSet.add( r3 );
@@ -154,7 +156,7 @@ public class RankingComparatorTest exten
}
- public void test_service_cm_ranking_sort()
+ @Test public void test_service_cm_ranking_sort()
{
ServiceReference<?> r1 = new MockServiceReference()
.setProperty( ConfigurationPlugin.CM_RANKING, new Integer( 100 ) );
@@ -176,7 +178,7 @@ public class RankingComparatorTest exten
}
- public void test_service_cm_ranking_set()
+ @Test public void test_service_cm_ranking_set()
{
ServiceReference<?> r1 = new MockServiceReference()
.setProperty( ConfigurationPlugin.CM_RANKING, new Integer( 100 ) );
@@ -184,7 +186,7 @@ public class RankingComparatorTest exten
new Integer( -100 ) );
ServiceReference<?> r3 = new MockServiceReference().setProperty( ConfigurationPlugin.CM_RANKING, null );
- Set<ServiceReference<?>> refSet = new TreeSet<ServiceReference<?>>( cmRank );
+ Set<ServiceReference<?>> refSet = new TreeSet<>( cmRank );
refSet.add( r1 );
refSet.add( r2 );
refSet.add( r3 );
@@ -200,7 +202,7 @@ public class RankingComparatorTest exten
static long id = 0;
- private final Map<String, Object> props = new HashMap<String, Object>();
+ private final Map<String, Object> props = new HashMap<>();
{
props.put( Constants.SERVICE_ID, new Long( id ) );
Modified: felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/helper/ConfigurationMapTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/helper/ConfigurationMapTest.java?rev=1831408&r1=1831407&r2=1831408&view=diff
==============================================================================
--- felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/helper/ConfigurationMapTest.java (original)
+++ felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/helper/ConfigurationMapTest.java Fri May 11 13:02:39 2018
@@ -22,10 +22,10 @@ package org.apache.felix.cm.impl.helper;
import java.util.HashMap;
import java.util.Map;
-import junit.framework.TestCase;
-
import org.junit.Test;
+import junit.framework.TestCase;
+
public class ConfigurationMapTest
{
@@ -33,7 +33,7 @@ public class ConfigurationMapTest
@Test
public void test_accepts()
{
- ConfigurationMap holder = new TestConfigurationMap( new String[]
+ ConfigurationMap<String> holder = new TestConfigurationMap( new String[]
{ "a", "b", "c" } );
TestCase.assertTrue( holder.accepts( "a" ) );
@@ -46,7 +46,7 @@ public class ConfigurationMapTest
@Test
public void test_isDifferentPids_null_null()
{
- ConfigurationMap holder = new TestConfigurationMap( null );
+ ConfigurationMap<String> holder = new TestConfigurationMap( null );
TestCase.assertFalse( "Expect both pids null to be the same", holder.isDifferentPids( null ) );
}
@@ -54,7 +54,7 @@ public class ConfigurationMapTest
@Test
public void test_isDifferentPids_null_notNull()
{
- ConfigurationMap holder = new TestConfigurationMap( null );
+ ConfigurationMap<String> holder = new TestConfigurationMap( null );
TestCase.assertTrue( "Expect not same for one pid not null", holder.isDifferentPids( new String[]
{ "entry" } ) );
}
@@ -63,7 +63,7 @@ public class ConfigurationMapTest
@Test
public void test_isDifferentPids_notNull_null()
{
- ConfigurationMap holder = new TestConfigurationMap( new String[]
+ ConfigurationMap<String> holder = new TestConfigurationMap( new String[]
{ "entry" } );
TestCase.assertTrue( "Expect not same for one pid not null", holder.isDifferentPids( null ) );
}
@@ -81,13 +81,13 @@ public class ConfigurationMapTest
final String[] pids30 =
{ "a", "b", "c" };
- final ConfigurationMap holder10 = new TestConfigurationMap( pids10 );
+ final ConfigurationMap<String> holder10 = new TestConfigurationMap( pids10 );
TestCase.assertFalse( holder10.isDifferentPids( pids10 ) );
TestCase.assertFalse( holder10.isDifferentPids( pids11 ) );
TestCase.assertTrue( holder10.isDifferentPids( pids20 ) );
TestCase.assertTrue( holder10.isDifferentPids( pids30 ) );
- final ConfigurationMap holder20 = new TestConfigurationMap( pids20 );
+ final ConfigurationMap<String> holder20 = new TestConfigurationMap( pids20 );
TestCase.assertTrue( holder20.isDifferentPids( pids10 ) );
TestCase.assertTrue( holder20.isDifferentPids( pids11 ) );
TestCase.assertFalse( holder20.isDifferentPids( pids20 ) );
@@ -110,7 +110,7 @@ public class ConfigurationMapTest
@Override
protected Map<String, String> createMap( int size )
{
- return new HashMap<String, String>( size );
+ return new HashMap<>( size );
}
Modified: felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/helper/TargetedPidTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/helper/TargetedPidTest.java?rev=1831408&r1=1831407&r2=1831408&view=diff
==============================================================================
--- felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/helper/TargetedPidTest.java (original)
+++ felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/helper/TargetedPidTest.java Fri May 11 13:02:39 2018
@@ -58,13 +58,13 @@ public class TargetedPidTest
final String location = "loc:" + symbolicName;
final Bundle b1 = createBundle( symbolicName, version, location );
- final ServiceReference r1 = createServiceReference( b1, pid );
+ final ServiceReference<?> r1 = createServiceReference( b1, pid );
- final ServiceReference rn = createServiceReference( createBundle( symbolicName + "_", version, location ), pid );
- final ServiceReference rv = createServiceReference(
+ final ServiceReference<?> rn = createServiceReference( createBundle( symbolicName + "_", version, location ), pid );
+ final ServiceReference<?> rv = createServiceReference(
createBundle( symbolicName, new Version( "0.2.0" ), location ), pid );
- final ServiceReference rl = createServiceReference( createBundle( symbolicName, version, location + "_" ), pid );
- final ServiceReference rnone = createServiceReference( null, pid );
+ final ServiceReference<?> rl = createServiceReference( createBundle( symbolicName, version, location + "_" ), pid );
+ final ServiceReference<?> rnone = createServiceReference( null, pid );
final TargetedPID p1 = new TargetedPID( String.format( "%s", pid ) );
@@ -85,13 +85,13 @@ public class TargetedPidTest
final String location = "loc:" + symbolicName;
final Bundle b1 = createBundle( symbolicName, version, location );
- final ServiceReference r1 = createServiceReference( b1, pid );
+ final ServiceReference<?> r1 = createServiceReference( b1, pid );
- final ServiceReference rn = createServiceReference( createBundle( symbolicName + "_", version, location ), pid );
- final ServiceReference rv = createServiceReference(
+ final ServiceReference<?> rn = createServiceReference( createBundle( symbolicName + "_", version, location ), pid );
+ final ServiceReference<?> rv = createServiceReference(
createBundle( symbolicName, new Version( "0.2.0" ), location ), pid );
- final ServiceReference rl = createServiceReference( createBundle( symbolicName, version, location + "_" ), pid );
- final ServiceReference rnone = createServiceReference( null, pid );
+ final ServiceReference<?> rl = createServiceReference( createBundle( symbolicName, version, location + "_" ), pid );
+ final ServiceReference<?> rnone = createServiceReference( null, pid );
final TargetedPID p1 = new TargetedPID( String.format( "%s|%s", pid, symbolicName ) );
@@ -112,13 +112,13 @@ public class TargetedPidTest
final String location = "loc:" + symbolicName;
final Bundle b1 = createBundle( symbolicName, version, location );
- final ServiceReference r1 = createServiceReference( b1, pid );
+ final ServiceReference<?> r1 = createServiceReference( b1, pid );
- final ServiceReference rn = createServiceReference( createBundle( symbolicName + "_", version, location ), pid );
- final ServiceReference rv = createServiceReference(
+ final ServiceReference<?> rn = createServiceReference( createBundle( symbolicName + "_", version, location ), pid );
+ final ServiceReference<?> rv = createServiceReference(
createBundle( symbolicName, new Version( "0.2.0" ), location ), pid );
- final ServiceReference rl = createServiceReference( createBundle( symbolicName, version, location + "_" ), pid );
- final ServiceReference rnone = createServiceReference( null, pid );
+ final ServiceReference<?> rl = createServiceReference( createBundle( symbolicName, version, location + "_" ), pid );
+ final ServiceReference<?> rnone = createServiceReference( null, pid );
final TargetedPID p1 = new TargetedPID( String.format( "%s|%s|%s", pid, symbolicName, version ) );
@@ -140,13 +140,13 @@ public class TargetedPidTest
final String location = "loc:" + symbolicName;
final Bundle b1 = createBundle( symbolicName, version, location );
- final ServiceReference r1 = createServiceReference( b1, pid );
+ final ServiceReference<?> r1 = createServiceReference( b1, pid );
- final ServiceReference rn = createServiceReference( createBundle( symbolicName + "_", version, location ), pid );
- final ServiceReference rv = createServiceReference(
+ final ServiceReference<?> rn = createServiceReference( createBundle( symbolicName + "_", version, location ), pid );
+ final ServiceReference<?> rv = createServiceReference(
createBundle( symbolicName, new Version( "0.2.0" ), location ), pid );
- final ServiceReference rl = createServiceReference( createBundle( symbolicName, version, location + "_" ), pid );
- final ServiceReference rnone = createServiceReference( null, pid );
+ final ServiceReference<?> rl = createServiceReference( createBundle( symbolicName, version, location + "_" ), pid );
+ final ServiceReference<?> rnone = createServiceReference( null, pid );
final TargetedPID p1 = new TargetedPID( String.format( "%s|%s|%s|%s", pid, symbolicName, version, location ) );
@@ -180,7 +180,7 @@ public class TargetedPidTest
ServiceReference<?> createServiceReference( final Bundle bundle, final Object pids )
{
- return new MockServiceReference()
+ return new MockServiceReference<Object>()
{
@Override
public Bundle getBundle()
Modified: felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/persistence/PersistenceManagerProxyTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/persistence/PersistenceManagerProxyTest.java?rev=1831408&r1=1831407&r2=1831408&view=diff
==============================================================================
--- felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/persistence/PersistenceManagerProxyTest.java (original)
+++ felix/trunk/configadmin/src/test/java/org/apache/felix/cm/impl/persistence/PersistenceManagerProxyTest.java Fri May 11 13:02:39 2018
@@ -18,6 +18,8 @@
*/
package org.apache.felix.cm.impl.persistence;
+import static org.junit.Assert.assertEquals;
+
import java.util.Collection;
import java.util.Dictionary;
import java.util.Hashtable;
@@ -25,10 +27,9 @@ import java.util.Hashtable;
import org.apache.felix.cm.MockNotCachablePersistenceManager;
import org.apache.felix.cm.PersistenceManager;
import org.apache.felix.cm.impl.SimpleFilter;
+import org.junit.Test;
import org.osgi.framework.Constants;
-import junit.framework.TestCase;
-
/**
* The <code>PersistenceManagerProxyTest</code> class tests the issues
@@ -36,10 +37,10 @@ import junit.framework.TestCase;
* <p>
* @see <a href="https://issues.apache.org/jira/browse/FELIX-4930">FELIX-4930</a>
*/
-public class PersistenceManagerProxyTest extends TestCase
+public class PersistenceManagerProxyTest
{
@SuppressWarnings({ "rawtypes", "unchecked" })
- public void test_caching_is_avoided() throws Exception {
+ @Test public void test_caching_is_avoided() throws Exception {
String pid = "testDefaultPersistenceManager";
SimpleFilter filter = SimpleFilter.parse("(&(service.pid=" + pid + ")(property1=value1))");