[java-identity-provider COMMIT] in /trunk: idp-core/src/test/java/net/shibboleth/idp/testing/DatabaseTestingSupport.j...

noreply at shibboleth.net noreply at shibboleth.net
Thu Mar 27 06:27:57 EDT 2014


Author: rdw
Date: Thu Mar 27 06:27:57 2014
New Revision: 5644

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5644&view=rev
Log:
Try to fix test order instability by tearing down table after each class.

Added:
    trunk/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/nameid/DeleteStore.sql
Modified:
    trunk/idp-core/src/test/java/net/shibboleth/idp/testing/DatabaseTestingSupport.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/DatabaseBackedIDStoreTest.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/PersistentSAML2NameIDGeneratorTest.java

Modified: trunk/idp-core/src/test/java/net/shibboleth/idp/testing/DatabaseTestingSupport.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-core/src/test/java/net/shibboleth/idp/testing/DatabaseTestingSupport.java?rev=5644&r1=5643&r2=5644&view=diff
==============================================================================
--- trunk/idp-core/src/test/java/net/shibboleth/idp/testing/DatabaseTestingSupport.java (original)
+++ trunk/idp-core/src/test/java/net/shibboleth/idp/testing/DatabaseTestingSupport.java Thu Mar 27 06:27:57 2014
@@ -50,7 +50,7 @@
     public static final String SP_ENTITY_ID = "https://sp.example.org/sp";
     
 
-    protected static void InitializeDataSource(@Nullable String initializingSQLFile, DataSource source) {
+    public static void InitializeDataSource(@Nullable String initializingSQLFile, DataSource source) {
 
         final String sql = ReadSqlFromFile(initializingSQLFile);
         if (sql == null) {

Modified: trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/DatabaseBackedIDStoreTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/DatabaseBackedIDStoreTest.java?rev=5644&r1=5643&r2=5644&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/DatabaseBackedIDStoreTest.java (original)
+++ trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/DatabaseBackedIDStoreTest.java Thu Mar 27 06:27:57 2014
@@ -25,17 +25,17 @@
 import javax.annotation.Nonnull;
 import javax.sql.DataSource;
 
-import net.shibboleth.idp.saml.impl.nameid.JDBCPersistentIdStore;
 import net.shibboleth.idp.saml.nameid.PersistentIdEntry;
 import net.shibboleth.idp.testing.DatabaseTestingSupport;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 import net.shibboleth.utilities.java.support.component.UninitializedComponentException;
 import net.shibboleth.utilities.java.support.component.UnmodifiableComponentException;
 
+import org.junit.AfterClass;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
-import org.testng.annotations.BeforeTest;
+import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
 import com.google.common.base.Objects;
@@ -54,10 +54,15 @@
         return CharStreams.toString(new InputStreamReader(is));
     }
     
-    @BeforeTest
+    @BeforeClass
     public void setupSource() throws IOException, IOException  {
-        testSource = DatabaseTestingSupport.GetMockDataSource("/net/shibboleth/idp/saml/impl/attribute/resolver/StoredIdStore.sql", "PersistentIdStore");
+        testSource = DatabaseTestingSupport.GetMockDataSource(PersistentSAML2NameIDGeneratorTest.INIT_FILE, "PersistentIdStore");
     }
+    
+    @AfterClass public void teardown() {
+        DatabaseTestingSupport.InitializeDataSource(PersistentSAML2NameIDGeneratorTest.DELETE_FILE, testSource);
+    }
+
     
     @Test public void initializeAndGetters() throws ComponentInitializationException, IOException {
 

Modified: trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/PersistentSAML2NameIDGeneratorTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/PersistentSAML2NameIDGeneratorTest.java?rev=5644&r1=5643&r2=5644&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/PersistentSAML2NameIDGeneratorTest.java (original)
+++ trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/PersistentSAML2NameIDGeneratorTest.java Thu Mar 27 06:27:57 2014
@@ -33,6 +33,7 @@
 import net.shibboleth.idp.testing.DatabaseTestingSupport;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 
+import org.junit.AfterClass;
 import org.opensaml.core.OpenSAMLInitBaseTestCase;
 import org.opensaml.core.xml.util.XMLObjectSupport;
 import org.opensaml.profile.ProfileException;
@@ -42,8 +43,8 @@
 import org.opensaml.saml.saml2.core.NameIDPolicy;
 import org.opensaml.saml.saml2.profile.SAML2ActionTestingSupport;
 import org.testng.Assert;
+import org.testng.annotations.BeforeClass;

[... 31 lines stripped ...]


More information about the commits mailing list