Skip to content

Commit

Permalink
adding more tests based on review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Arun Venmany <[email protected]>
  • Loading branch information
arunvenmany-ibm committed Nov 20, 2024
1 parent bb6611a commit d2f6c55
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ jobs:
- name: Checkout ci.common
uses: actions/checkout@v3
with:
repository: arunvenmany-ibm/ci.common
repository: OpenLiberty/ci.common
path: ci.common
ref: spring-boot-application-node-bug-fix
- name: Checkout ci.ant
uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -125,7 +124,7 @@ jobs:
- name: Clone ci.ant, ci.common, ci.gradle repos to C drive
run: |
cp -r D:/a/ci.gradle/ci.gradle C:/ci.gradle
git clone https://github.com/arunvenmany-ibm/ci.common.git --branch spring-boot-application-node-bug-fix --single-branch C:/ci.common
git clone https://github.com/OpenLiberty/ci.common.git C:/ci.common
git clone https://github.com/OpenLiberty/ci.ant.git C:/ci.ant
# Cache mvn/gradle packages
- name: Cache Maven packages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,5 +216,23 @@ abstract class AbstractIntegrationTest {
}
}
}

/**
* Count number of lines that contain the given string
*/
protected static int countOccurrences(String str, File file) throws FileNotFoundException, IOException {
int occurrences = 0;
BufferedReader br = new BufferedReader(new FileReader(file));
String line = br.readLine();
try {
while (line != null) {
if (line.contains(str)) {
occurrences++;
}
line = br.readLine();
}
} finally {
br.close();
}
return occurrences;
}
}
20 changes: 0 additions & 20 deletions src/test/groovy/io/openliberty/tools/gradle/BaseDevTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -258,26 +258,6 @@ class BaseDevTest extends AbstractIntegrationTest {
Files.write(path, content.getBytes(charset));
}

/**
* Count number of lines that contain the given string
*/
protected static int countOccurrences(String str, File file) throws FileNotFoundException, IOException {
int occurrences = 0;
BufferedReader br = new BufferedReader(new FileReader(file));
String line = br.readLine();
try {
while (line != null) {
if (line.contains(str)) {
occurrences++;
}
line = br.readLine();
}
} finally {
br.close();
}
return occurrences;
}

protected static void cleanUpAfterClass(boolean isDevMode) throws Exception {
stopProcess(isDevMode, errFile);
if (buildDir != null && buildDir.exists()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public class TestSpringBootApplication30 extends AbstractIntegrationTest{
new File(buildDir, 'build/wlp/usr/servers/defaultServer/dropins').list().size() == 0)
Assert.assertTrue('defaultServer/configDropins/defaults has no config',
new File(buildDir, 'build/wlp/usr/servers/defaultServer/configDropins/defaults').list().size() == 1)
File configDropinsDir=new File(buildDir, 'build/wlp/usr/servers/defaultServer/configDropins/defaults')
File configDropinsFile=new File(configDropinsDir,configDropinsDir.list().getAt(0))
Assert.assertTrue("defaultServer/configDropins/defaults config file does not contain thin spring boot location",countOccurrences("thin-${testName.getMethodName()}-1.0-SNAPSHOT.jar".toString(), configDropinsFile)>0);
Assert.assertTrue('no app in apps folder',
new File(buildDir, "build/wlp/usr/servers/defaultServer/apps/thin-${testName.getMethodName()}-1.0-SNAPSHOT.jar").exists() )
} catch (Exception e) {
Expand Down

0 comments on commit d2f6c55

Please sign in to comment.