Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/560#discussion_r103887396
  
    --- Diff: 
launcher/src/test/java/org/apache/brooklyn/launcher/CleanOrphanedLocationsIntegrationTest.java
 ---
    @@ -66,13 +72,26 @@
         private Set<ManagementContext> mgmts;
         private ManagementContext mgmt;
     
    +    private String copyResourcePathToTempPath(String resourcePath) {
    +        BundleMaker bm = new BundleMaker(ResourceUtils.create(this));
    +        
bm.setDefaultClassForLoading(CleanOrphanedLocationsIntegrationTest.class);
    +        File jar = bm.createJarFromClasspathDir(resourcePath);
    +        File output = 
Os.newTempDir("brooklyn-test-resouce-from-"+resourcePath);
    +        try {
    +            ArchiveUtils.extractZip(new ZipFile(jar), 
output.getAbsolutePath());
    +            return output.getAbsolutePath();
    +        } catch (Exception e) {
    +            throw Exceptions.propagate(e);
    +        }
    +    }
    +    
         @BeforeMethod(alwaysRun = true)
         @Override
         public void setUp() throws Exception {
             super.setUp();
    -        persistenceDirWithOrphanedLocations = 
getClass().getResource(PERSISTED_STATE_PATH_WITH_ORPHANED_LOCATIONS).getFile();
    -        persistenceDirWithoutOrphanedLocations = 
getClass().getResource(PERSISTED_STATE_PATH_WITHOUT_ORPHANED_LOCATIONS).getFile();
    -        persistenceDirWithMultipleLocationsOccurrence = 
getClass().getResource(PERSISTED_STATE_PATH_WITH_MULTIPLE_LOCATIONS_OCCURRENCE).getFile();
    +        persistenceDirWithOrphanedLocations = 
copyResourcePathToTempPath(PERSISTED_STATE_PATH_WITH_ORPHANED_LOCATIONS);
    +        persistenceDirWithoutOrphanedLocations = 
copyResourcePathToTempPath(PERSISTED_STATE_PATH_WITHOUT_ORPHANED_LOCATIONS);
    +        persistenceDirWithMultipleLocationsOccurrence = 
copyResourcePathToTempPath(PERSISTED_STATE_PATH_WITH_MULTIPLE_LOCATIONS_OCCURRENCE);
    --- End diff --
    
    There's the 
[File(URI)](https://docs.oracle.com/javase/7/docs/api/java/io/File.html#File(java.net.URI))
 constructor. That's tests so it's pretty safe to assume they execute from the 
file system.
    
    Since what you wrote works correctly I'm happy to leave it as is.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to