Update of
/cvsroot/jicarilla/jicarilla-sandbox/platform/framework/impl/src/test/com/leosimons/jicarilla/framework/test
In directory
sc8-pr-cvs1:/tmp/cvs-serv22244/platform/framework/impl/src/test/com/leosimons/jicarilla/framework/test
Modified Files:
AbstractAsyncEnabledTestCase.java
AbstractReadonlyEnabledTestCase.java
PostProcessorTestCase.java SimpleAlternatorTestCase.java
SimpleMulticasterTestCase.java SimpleScreenerTestCase.java
Log Message:
Quite a few changes:
* improve on the javadocs
* rename a few methods for consistency
* fix bug in PostProcessor (which was a PreProcessor!)
* unify synchronization/multithread setup
Index: AbstractAsyncEnabledTestCase.java
===================================================================
RCS file:
/cvsroot/jicarilla/jicarilla-sandbox/platform/framework/impl/src/test/com/leosimons/jicarilla/framework/test/AbstractAsyncEnabledTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- AbstractAsyncEnabledTestCase.java 17 Dec 2003 23:23:02 -0000 1.2
+++ AbstractAsyncEnabledTestCase.java 29 Dec 2003 13:46:18 -0000 1.3
@@ -151,9 +151,9 @@
return m_incoming;
}
- public Object getImmediateResult()
+ public Object getImmediateResult( Invocation invocation )
{
- return super.getImmediateResult();
+ return super.getImmediateResult( invocation );
}
public void doHandle( Invocation i )
@@ -193,7 +193,8 @@
public void testGetImmediateResult()
{
- assertNull( aei.getImmediateResult() );
+ assertNull( aei.getImmediateResult( null ) );
+ assertNull( aei.getImmediateResult( new Invocation() ) );
}
public void testHandle() throws Throwable
Index: AbstractReadonlyEnabledTestCase.java
===================================================================
RCS file:
/cvsroot/jicarilla/jicarilla-sandbox/platform/framework/impl/src/test/com/leosimons/jicarilla/framework/test/AbstractReadonlyEnabledTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- AbstractReadonlyEnabledTestCase.java 17 Dec 2003 23:23:02 -0000
1.2
+++ AbstractReadonlyEnabledTestCase.java 29 Dec 2003 13:46:18 -0000
1.3
@@ -48,47 +48,47 @@
/**
* Determine whether makeReadOnly() has been called.
*/
- protected boolean isReadonly()
+ protected boolean isReadOnly()
{
- return super.isReadonly();
+ return super.isReadOnly();
}
/**
* Throw an IllegalStateException if makeReadOnly() has been called.
*/
- protected void checkReadonly()
+ protected void checkReadOnly()
{
- super.checkReadonly();
+ super.checkReadOnly();
}
}
public void testIsReadonly()
{
Readonly r = new Readonly();
- assertFalse( r.isReadonly() );
+ assertFalse( r.isReadOnly() );
r.makeReadOnly();
- assertTrue( r.isReadonly() );
+ assertTrue( r.isReadOnly() );
// multiple
r.makeReadOnly();
r.makeReadOnly();
r.makeReadOnly();
r.makeReadOnly();
- assertTrue( r.isReadonly() );
+ assertTrue( r.isReadOnly() );
}
public void testCheckReadonly()
{
Readonly r = new Readonly();
- r.checkReadonly();
+ r.checkReadOnly();
// multiple
- r.checkReadonly();
- r.checkReadonly();
- r.checkReadonly();
- r.checkReadonly();
+ r.checkReadOnly();
+ r.checkReadOnly();
+ r.checkReadOnly();
+ r.checkReadOnly();
r.makeReadOnly();
@@ -98,7 +98,7 @@
IllegalStateException ise = null;
try
{
- r.checkReadonly();
+ r.checkReadOnly();
}
catch( IllegalStateException e )
{
Index: PostProcessorTestCase.java
===================================================================
RCS file:
/cvsroot/jicarilla/jicarilla-sandbox/platform/framework/impl/src/test/com/leosimons/jicarilla/framework/test/PostProcessorTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- PostProcessorTestCase.java 17 Dec 2003 23:23:02 -0000 1.2
+++ PostProcessorTestCase.java 29 Dec 2003 13:46:18 -0000 1.3
@@ -165,7 +165,7 @@
p.put( new Object() );
p.put( new Object() );
- assertEquals( 4, p.processed );
+ assertEquals( 0, p.processed );
}
public void testOffer() throws InterruptedException
@@ -176,6 +176,40 @@
p.offer( new Object(), 100 );
p.offer( new Object(), 100 );
p.offer( new Object(), 100 );
+
+ assertEquals( 0, p.processed );
+ }
+
+ public void testTake() throws InterruptedException
+ {
+ final Processor p = new Processor( c, e );
+
+ p.put( new Object() );
+ p.put( new Object() );
+ p.put( new Object() );
+ p.put( new Object() );
+
+ p.take();
+ p.take();
+ p.take();
+ p.take();
+
+ assertEquals( 4, p.processed );
+ }
+
+ public void testPoll() throws InterruptedException
+ {
+ final Processor p = new Processor( c, e );
+
+ p.put( new Object() );
+ p.put( new Object() );
+ p.put( new Object() );
+ p.put( new Object() );
+
+ p.poll( 100 );
+ p.poll( 100 );
+ p.poll( 100 );
+ p.poll( 100 );
assertEquals( 4, p.processed );
}
Index: SimpleAlternatorTestCase.java
===================================================================
RCS file:
/cvsroot/jicarilla/jicarilla-sandbox/platform/framework/impl/src/test/com/leosimons/jicarilla/framework/test/SimpleAlternatorTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- SimpleAlternatorTestCase.java 17 Dec 2003 23:23:02 -0000 1.2
+++ SimpleAlternatorTestCase.java 29 Dec 2003 13:46:18 -0000 1.3
@@ -219,7 +219,7 @@
public int getSize()
{
- return m_size;
+ return m_sinks.size();
}
}
Index: SimpleMulticasterTestCase.java
===================================================================
RCS file:
/cvsroot/jicarilla/jicarilla-sandbox/platform/framework/impl/src/test/com/leosimons/jicarilla/framework/test/SimpleMulticasterTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- SimpleMulticasterTestCase.java 17 Dec 2003 23:23:02 -0000 1.2
+++ SimpleMulticasterTestCase.java 29 Dec 2003 13:46:18 -0000 1.3
@@ -194,7 +194,7 @@
public int getSize()
{
- return m_size;
+ return m_sinks.size();
}
}
Index: SimpleScreenerTestCase.java
===================================================================
RCS file:
/cvsroot/jicarilla/jicarilla-sandbox/platform/framework/impl/src/test/com/leosimons/jicarilla/framework/test/SimpleScreenerTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- SimpleScreenerTestCase.java 17 Dec 2003 23:23:02 -0000 1.2
+++ SimpleScreenerTestCase.java 29 Dec 2003 13:46:18 -0000 1.3
@@ -199,7 +199,7 @@
public int getSize()
{
- return m_size;
+ return m_sinks.size();
}
}
}
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
|