[java-identity-provider COMMIT] /branches/3.3/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/rely...

noreply at shibboleth.net noreply at shibboleth.net
Mon Mar 6 16:53:45 EST 2017


Author: scantor
Date: Mon Mar  6 16:53:44 2017
New Revision: 8651

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=8651&view=rev
Log:
BPr8566 - IDP-1085: LocalDynamicMetadataProviderParserTest should clean up test directories

Modified:
    branches/3.3/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/LocalDynamicMetadataProviderParserTest.java

Modified: branches/3.3/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/LocalDynamicMetadataProviderParserTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/branches/3.3/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/LocalDynamicMetadataProviderParserTest.java?rev=8651&r1=8650&r2=8651&view=diff
==============================================================================
--- branches/3.3/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/LocalDynamicMetadataProviderParserTest.java	(original)
+++ branches/3.3/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/LocalDynamicMetadataProviderParserTest.java	Mon Mar  6 16:53:44 2017
@@ -30,6 +30,8 @@
 import org.opensaml.security.crypto.JCAConstants;
 import org.springframework.context.ApplicationContext;
 import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 import net.shibboleth.idp.saml.metadata.RelyingPartyMetadataProvider;
@@ -41,6 +43,23 @@
  *
  */
 public class LocalDynamicMetadataProviderParserTest extends AbstractMetadataParserTest {
+    
+    private File sourceDirectory;
+    
+    @BeforeMethod
+    public void setUp() {
+        sourceDirectory = new File(System.getProperty("java.io.tmpdir"), "localDynamicMD");
+    }
+    
+    @AfterMethod
+    public void tearDown() {
+        if (sourceDirectory.exists()) {
+            for (File child : sourceDirectory.listFiles()) {
+                child.delete();
+            }
+            sourceDirectory.delete();
+        }
+    }
     
     @Test
     public void testDefaults() throws Exception {
@@ -109,7 +128,6 @@
         EntityDescriptor entity = (EntityDescriptor) XMLObjectSupport.buildXMLObject(EntityDescriptor.DEFAULT_ELEMENT_NAME);
         entity.setEntityID(entityID);
         
-        File sourceDirectory = new File(System.getProperty("java.io.tmpdir"), "localDynamicMD");
         if (!sourceDirectory.exists()) {
             Assert.assertTrue(sourceDirectory.mkdirs());
         }
@@ -137,4 +155,6 @@
         Assert.assertNotNull(resolved);
         Assert.assertEquals(resolved.getEntityID(), entityID);
     }
+    
+
 }



More information about the commits mailing list