polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [4/8] zest-java git commit: jclouds-entitystore: properly isolate test
Date Sat, 03 Dec 2016 11:06:00 GMT
jclouds-entitystore: properly isolate test


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/d8a76c05
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/d8a76c05
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/d8a76c05

Branch: refs/heads/develop
Commit: d8a76c052b33092a2f6ecffef747164baebef825
Parents: d833c4f
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Fri Dec 2 18:00:40 2016 +0100
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Fri Dec 2 18:00:40 2016 +0100

----------------------------------------------------------------------
 .../jclouds/JCloudsFilesystemTest.java          | 32 ++++++++------------
 1 file changed, 13 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/d8a76c05/extensions/entitystore-jclouds/src/test/java/org/apache/zest/entitystore/jclouds/JCloudsFilesystemTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/src/test/java/org/apache/zest/entitystore/jclouds/JCloudsFilesystemTest.java
b/extensions/entitystore-jclouds/src/test/java/org/apache/zest/entitystore/jclouds/JCloudsFilesystemTest.java
index 584cb4a..6bbff6f 100644
--- a/extensions/entitystore-jclouds/src/test/java/org/apache/zest/entitystore/jclouds/JCloudsFilesystemTest.java
+++ b/extensions/entitystore-jclouds/src/test/java/org/apache/zest/entitystore/jclouds/JCloudsFilesystemTest.java
@@ -20,43 +20,37 @@
 
 package org.apache.zest.entitystore.jclouds;
 
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.zest.api.time.SystemTime;
-import org.apache.zest.entitystore.jclouds.assembly.JCloudsEntityStoreAssembler;
-import org.jclouds.filesystem.reference.FilesystemConstants;
-import org.junit.AfterClass;
+import java.util.Collections;
 import org.apache.zest.api.common.Visibility;
 import org.apache.zest.bootstrap.AssemblyException;
 import org.apache.zest.bootstrap.ModuleAssembly;
+import org.apache.zest.entitystore.jclouds.assembly.JCloudsEntityStoreAssembler;
 import org.apache.zest.test.EntityTestAssembler;
 import org.apache.zest.test.entity.AbstractEntityStoreTest;
 import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+import org.jclouds.filesystem.reference.FilesystemConstants;
+import org.junit.Rule;
+import org.junit.rules.TemporaryFolder;
 
 public class JCloudsFilesystemTest
-        extends AbstractEntityStoreTest
+    extends AbstractEntityStoreTest
 {
+    @Rule
+    public TemporaryFolder tmpDir = new TemporaryFolder();
 
     @Override
     public void assemble( ModuleAssembly module )
-            throws AssemblyException
+        throws AssemblyException
     {
         super.assemble( module );
         ModuleAssembly config = module.layer().module( "config" );
         new EntityTestAssembler().assemble( config );
         new OrgJsonValueSerializationAssembler().assemble( module );
         new JCloudsEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble(
module );
-        JCloudsMapEntityStoreConfiguration defaults = config.forMixin( JCloudsMapEntityStoreConfiguration.class
).declareDefaults();
+        JCloudsMapEntityStoreConfiguration defaults = config.forMixin( JCloudsMapEntityStoreConfiguration.class
)
+                                                            .declareDefaults();
         defaults.provider().set( "filesystem" );
-        Map<String, String> props = new HashMap<String, String>();
-        props.put( FilesystemConstants.PROPERTY_BASEDIR, "build/tmp/" + getClass().getPackage().getName()
+ "/es-jclouds-" + SystemTime.now().toEpochMilli() );
-        defaults.properties().set( props );
+        defaults.properties().set( Collections.singletonMap( FilesystemConstants.PROPERTY_BASEDIR,
+                                                             tmpDir.getRoot().getAbsolutePath()
) );
     }
-
-    @AfterClass
-    public static void filesystemCleanup()
-    {
-        // TODO recursively delete "build/tmp/" + getClass().getPackage().getName()
-    }
-
 }


Mime
View raw message