Skip to content
This repository was archived by the owner on Nov 15, 2022. It is now read-only.

Commit 12e5b60

Browse files
SAMEER PANDITarindam-bandyopadhyay
authored andcommitted
Stabilize hudson (#21734)
* remove osgi-cache for domains * add util methods, touch the nucleus root and as root before tests * remove unnecessary changes, add copyrights
1 parent 0958f5e commit 12e5b60

File tree

3 files changed

+64
-5
lines changed

3 files changed

+64
-5
lines changed

main/nucleus/test-utils/utils-ng/src/main/java/org/glassfish/tests/utils/NucleusTestUtils.java

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright (c) 2012-2013 Oracle and/or its affiliates. All rights reserved.
4+
* Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
55
*
66
* The contents of this file are subject to the terms of either the GNU
77
* General Public License Version 2 only ("GPL") or the Common Development
@@ -335,4 +335,58 @@ public static class NadminReturn {
335335
public String outAndErr;
336336
}
337337

338+
public static void deleteDirectoryContents(final File dir) {
339+
if (dir == null || !dir.exists()) {
340+
return;
341+
}
342+
System.out.println("Deleting contents of directory : " + dir);
343+
File[] files = dir.listFiles();
344+
if(files!=null) {
345+
for(File f: files) {
346+
if(f.isDirectory()) {
347+
deleteDirectory(f);
348+
}else{
349+
f.delete();
350+
}
351+
}
352+
}
353+
}
354+
355+
public static void deleteDirectory (final File dir) {
356+
if (dir == null || !dir.exists()) {
357+
return;
358+
}
359+
File[] files = dir.listFiles();
360+
if(files!=null) {
361+
for(File f: files) {
362+
if(f.isDirectory()) {
363+
deleteDirectory(f);
364+
}else{
365+
f.delete();
366+
}
367+
}
368+
}
369+
dir.delete();
370+
}
371+
372+
public static void touchDirectory (final File dir) {
373+
if (dir == null || !dir.exists()) {
374+
return;
375+
}
376+
long timestamp;
377+
File[] files = dir.listFiles();
378+
if(files!=null) {
379+
for(File f: files) {
380+
if(f.isDirectory()) {
381+
touchDirectory(f);
382+
}else{
383+
timestamp = System.currentTimeMillis();
384+
f.setLastModified(timestamp);
385+
}
386+
}
387+
}
388+
timestamp = System.currentTimeMillis();
389+
dir.setLastModified(timestamp);
390+
System.out.println("Touched contents of directory : " + dir);
391+
}
338392
}

main/nucleus/tests/admin/src/test/java/org/glassfish/nucleus/admin/progress/DetachAttachTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
4+
* Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
55
*
66
* The contents of this file are subject to the terms of either the GNU
77
* General Public License Version 2 only ("GPL") or the Common Development
@@ -44,6 +44,7 @@
4444
import java.util.HashSet;
4545
import java.util.List;
4646
import java.util.Set;
47+
import java.io.File;
4748
import java.util.StringTokenizer;
4849
import java.util.concurrent.Callable;
4950
import java.util.concurrent.ExecutionException;
@@ -62,11 +63,14 @@
6263
*/
6364
@Test(testName="DetachAttachTest")
6465
public class DetachAttachTest {
65-
66+
private static File nucleusRoot = getNucleusRoot();
67+
6668
@AfterTest
6769
public void cleanUp() throws Exception {
6870
nadmin("stop-domain");
6971
JobManagerTest.deleteJobsFile();
72+
//osgi-cache workaround
73+
touchDirectory(nucleusRoot);
7074
nadmin("start-domain");
7175
}
7276

main/nucleus/tests/admin/src/test/java/org/glassfish/nucleus/admin/progress/JobManagerTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
4+
* Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
55
*
66
* The contents of this file are subject to the terms of either the GNU
77
* General Public License Version 2 only ("GPL") or the Common Development
@@ -65,7 +65,8 @@ public void setUp() throws Exception {
6565
nadmin("stop-domain");
6666
//delete jobs.xml incase there were other jobs run
6767
deleteJobsFile();
68-
68+
//osgi-cache workaround
69+
touchDirectory(nucleusRoot);
6970
nadmin("start-domain");
7071

7172

0 commit comments

Comments
 (0)