You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wink.apache.org by gp...@apache.org on 2013/08/08 19:10:50 UTC
svn commit: r1511881 -
/wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/lifecycle/JSR250OFFactoryTest.java
Author: gpetracek
Date: Thu Aug 8 17:10:50 2013
New Revision: 1511881
URL: http://svn.apache.org/r1511881
Log:
WINK-405 fixed parameter order
Modified:
wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/lifecycle/JSR250OFFactoryTest.java
Modified: wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/lifecycle/JSR250OFFactoryTest.java
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/lifecycle/JSR250OFFactoryTest.java?rev=1511881&r1=1511880&r2=1511881&view=diff
==============================================================================
--- wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/lifecycle/JSR250OFFactoryTest.java (original)
+++ wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/lifecycle/JSR250OFFactoryTest.java Thu Aug 8 17:10:50 2013
@@ -24,11 +24,10 @@ import javax.annotation.PreDestroy;
import javax.ws.rs.Path;
import javax.ws.rs.ext.Provider;
-import junit.framework.TestCase;
-
import org.apache.wink.common.RuntimeContext;
import org.apache.wink.common.internal.runtime.RuntimeContextTLS;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -130,16 +129,17 @@ public class JSR250OFFactoryTest {
assertEquals(JSR250SingletonObjectFactory.class, of.getClass());
// due to behavior of singleton instances, the object will have already been created without
// calling of.getInstance(RuntimeContext)
- assertEquals(called, ProviderPostConstructSingleton.class.getSimpleName() + ".postConstruct()");
+ assertEquals(ProviderPostConstructSingleton.class.getSimpleName() + ".postConstruct()", called);
}
@Test
+ @Ignore //this test isn't valid see comment at postConstruct2
public void testFirstPostConstructCalled() {
ObjectFactory of = factoryRegistry.getObjectFactory(ProviderPostConstructDoubleSingleton.class);
assertEquals(JSR250SingletonObjectFactory.class, of.getClass());
// due to behavior of singleton instances, the object will have already been created without
// calling of.getInstance(RuntimeContext)
- assertEquals(called, ProviderPostConstructDoubleSingleton.class.getSimpleName() + ".postConstruct1()");
+ assertEquals(ProviderPostConstructDoubleSingleton.class.getSimpleName() + ".postConstruct1()", called);
}
@Test
@@ -147,12 +147,12 @@ public class JSR250OFFactoryTest {
ObjectFactory of = factoryRegistry.getObjectFactory(ProviderPreDestroySingleton.class);
assertEquals(JSR250SingletonObjectFactory.class, of.getClass());
// no PostConstruct in ProviderPreDestroySingleton
- assertEquals(called, null);
+ assertEquals(null, called);
RuntimeContext context = RuntimeContextTLS.getRuntimeContext();
of.releaseInstance(of.getInstance(context), context);
- assertEquals(called, null); // we don't want releaseInstance to call @PreDestroy annotated method for singletons
+ assertEquals(null, called); // we don't want releaseInstance to call @PreDestroy annotated method for singletons
of.releaseAll(context);
- assertEquals(called, ProviderPreDestroySingleton.class.getSimpleName() + ".preDestroy()");
+ assertEquals(ProviderPreDestroySingleton.class.getSimpleName() + ".preDestroy()", called);
}
@Test
@@ -160,14 +160,14 @@ public class JSR250OFFactoryTest {
ObjectFactory of = factoryRegistry.getObjectFactory(MyResource.class);
assertEquals(JSR250PrototypeObjectFactory.class, of.getClass());
// due to being a "Prototype" object factory, instances are only created upon request
- assertEquals(called, null);
+ assertEquals(null, called);
RuntimeContext context = RuntimeContextTLS.getRuntimeContext();
of.getInstance(null);
- assertEquals(called, MyResource.class.getSimpleName() + ".postConstruct()");
+ assertEquals(MyResource.class.getSimpleName() + ".postConstruct()", called);
called = null;
of.releaseAll(context);
- assertEquals(called, null); // instances created by "Prototype" object factories are per-request instances, not per-app or per-jvm
+ assertEquals(null, called); // instances created by "Prototype" object factories are per-request instances, not per-app or per-jvm
of.releaseInstance(of.getInstance(context), context);
- assertEquals(called, MyResource.class.getSimpleName() + ".preDestroy()"); // we *do* want releaseInstance to call @PreDestroy annotated method for per-request instances
+ assertEquals(MyResource.class.getSimpleName() + ".preDestroy()", called); // we *do* want releaseInstance to call @PreDestroy annotated method for per-request instances
}
}