Skip to content

Commit fbb4e58

Browse files
committed
Changed file structure
1 parent 2dc8891 commit fbb4e58

43 files changed

Lines changed: 49 additions & 54 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 1 deletion

scripts/sql/create_app_objects.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
whenever sqlerror exit failure rollback
22
whenever oserror exit failure rollback
33

4-
@src/test/resources/simple-project/scripts/sources/TO_TEST_ME.tab
5-
@src/test/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.spc
6-
@src/test/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy
4+
@src/test/resources/integration-tests/simple-project/scripts/sources/TO_TEST_ME.tab
5+
@src/test/resources/integration-tests/simple-project/scripts/sources/APP.PKG_TEST_ME.spc
6+
@src/test/resources/integration-tests/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy
77

8-
@src/test/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc
9-
@src/test/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy
8+
@src/test/resources/integration-tests/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc
9+
@src/test/resources/integration-tests/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
whenever sqlerror exit failure rollback
22
whenever oserror exit failure rollback
33

4-
@src/test/resources/owner-param-project/scripts/sources/foo/tables/TO_TEST_ME.tab
5-
@src/test/resources/owner-param-project/scripts/sources/foo/packages/PKG_TEST_ME.sql
6-
@src/test/resources/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql
4+
@src/test/resources/integration-tests/owner-param-project/scripts/sources/foo/tables/TO_TEST_ME.tab
5+
@src/test/resources/integration-tests/owner-param-project/scripts/sources/foo/packages/PKG_TEST_ME.sql
6+
@src/test/resources/integration-tests/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql

scripts/sql/create_tests_owner_objects.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ whenever oserror exit failure rollback
33

44
create synonym TO_TEST_ME for CODE_OWNER.TO_TEST_ME;
55
create synonym PKG_TEST_ME for CODE_OWNER.PKG_TEST_ME;
6-
@src/test/resources/owner-param-project/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql
7-
@src/test/resources/owner-param-project/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql
6+
@src/test/resources/integration-tests/owner-param-project/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql
7+
@src/test/resources/integration-tests/owner-param-project/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql

src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java

Lines changed: 38 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import static org.junit.Assert.assertEquals;
2222
import static org.junit.Assert.assertFalse;
2323
import static org.junit.Assert.assertTrue;
24-
import static org.junit.Assert.fail;
2524

2625
public class UtPLSQLMojoIT {
2726

@@ -44,111 +43,107 @@ public static void setUp() throws VerificationException, IOException, XmlPullPar
4443

4544
@Test
4645
public void simpleProject() throws IOException, VerificationException {
47-
final String PROJECT_NAME = "simple-project";
48-
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
46+
final String testFolder = "integration-tests/simple-project";
47+
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder);
4948

5049
Verifier verifier = createVerifier(testProject);
5150
verifier.executeGoal("test");
5251

53-
checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml");
52+
checkReportsGenerated(testFolder, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml");
5453
}
5554

5655
@Test
5756
public void regexProject() throws IOException, VerificationException {
58-
final String PROJECT_NAME = "regex-project";
59-
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
57+
final String testFolder = "integration-tests/regex-project";
58+
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder);
6059

6160
Verifier verifier = createVerifier(testProject);
6261
verifier.executeGoal("test");
6362

64-
checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml");
63+
checkReportsGenerated(testFolder, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml");
6564
}
6665

6766
@Test
6867
public void typeMappingProject() throws IOException, VerificationException {
69-
final String PROJECT_NAME = "type-mapping-project";
70-
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
68+
final String testFolder = "integration-tests/type-mapping-project";
69+
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder);
7170

7271
Verifier verifier = createVerifier(testProject);
7372
verifier.executeGoal("test");
7473

75-
checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml");
74+
checkReportsGenerated(testFolder, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml");
7675
}
7776

7877
@Test
7978
public void ownerParameterProject() throws IOException, VerificationException {
80-
final String PROJECT_NAME = "owner-param-project";
81-
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
79+
final String testFolder = "integration-tests/owner-param-project";
80+
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder);
8281

8382
Verifier verifier = createVerifier(testProject);
8483
verifier.executeGoal("test");
8584

86-
checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml");
85+
checkReportsGenerated(testFolder, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml");
8786
}
8887

8988
@Test
9089
public void minimalistProject() throws IOException, VerificationException {
91-
final String PROJECT_NAME = "minimalist-project";
92-
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
90+
final String testFolder = "integration-tests/minimalist-project";
91+
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder);
9392

9493
Verifier verifier = createVerifier(testProject);
9594
verifier.executeGoal("test");
9695
}
9796

9897
@Test
9998
public void tagsProject() throws IOException, VerificationException {
100-
final String PROJECT_NAME = "tags-project";
101-
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
99+
final String testFolder = "integration-tests/tags-project";
100+
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder);
102101

103102
Verifier verifier = createVerifier(testProject);
104103
verifier.executeGoal("test");
105104

106-
checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml");
105+
checkReportsGenerated(testFolder, "utplsql/sonar-test-reporter.xml");
107106
}
108107

109108
@Test
110109
public void skipUtplsqlTests() throws IOException, VerificationException {
111-
final String PROJECT_NAME = "skip-project";
112-
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
110+
final String testFolder = "integration-tests/skip-project";
111+
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder);
113112

114113
Verifier verifier = createVerifier(testProject);
115114
verifier.executeGoal("test");
116115

117-
assertFalse(new File("target/test-classes/" + PROJECT_NAME + "/target").exists());
116+
assertFalse(new File("target/test-classes/" + testFolder + "/target").exists());
118117
}
119118

120119
/**
121120
* Duration is set to 1 before comparing contents as it is always different.
122121
* Path separator is set to "/" to ensure windows / linux / mac compatibility.
123122
* \r and \n are removed to provide simpler comparison.
124123
*
125-
* @param projectName Project name
126-
* @param files Files to compare
124+
* @param testFolder Project name
125+
* @param files Files to compare
127126
*/
128-
private void checkReportsGenerated(String projectName, String... files) {
127+
private void checkReportsGenerated(String testFolder, String... files) throws IOException {
129128
for (String filename : files) {
130-
File outputFile = new File("target/test-classes/" + projectName + "/target", filename);
131-
File expectedOutputFile = new File("target/test-classes/" + projectName + "/expected-output", filename);
129+
File outputFile = new File("target/test-classes/" + testFolder + "/target", filename);
130+
File expectedOutputFile = new File("target/test-classes/" + testFolder + "/expected-output", filename);
132131

133132
assertTrue("The reporter for " + filename + " was not generated", outputFile.exists());
134133

135-
try {
136-
try (Stream<String> stream = Files.lines(Paths.get("target", "test-classes", projectName, "target", filename))) {
137-
String outputContent = stream
138-
.filter(line -> !line.contains("<?xml"))
139-
.map(line -> line.replaceAll("(duration=\"[0-9.]*\")", "duration=\"1\""))
140-
.map(line -> line.replaceAll("\\\\", "/"))
141-
.map(line -> line.replaceAll("\r", "").replaceAll("\n", ""))
142-
.collect(Collectors.joining("\n"));
143-
assertEquals("The files differ!",
144-
FileUtils.readFileToString(expectedOutputFile, "utf-8")
145-
.replace("\r", "")
146-
.replace("\n", ""),
147-
outputContent.replace("\n", ""));
148-
}
149-
} catch (IOException e) {
150-
e.printStackTrace();
151-
fail("Unexpected Exception running the test : " + e.getMessage());
134+
try (Stream<String> stream = Files.lines(Paths.get("target", "test-classes", testFolder, "target", filename))) {
135+
String outputContent = stream
136+
.filter(line -> !line.contains("<?xml"))
137+
.map(line -> line.replaceAll("(duration=\"[0-9.]*\")", "duration=\"1\""))
138+
.map(line -> line.replaceAll("\\\\", "/"))
139+
.map(line -> line.replaceAll("\r", "").replaceAll("\n", ""))
140+
.collect(Collectors.joining("\n"));
141+
142+
assertEquals("The files differ!",
143+
FileUtils.readFileToString(expectedOutputFile, "utf-8")
144+
.replace("\r", "")
145+
.replace("\n", ""),
146+
outputContent.replace("\n", ""));
152147
}
153148
}
154149
}

src/test/resources/minimalist-project/pom.xml renamed to src/test/resources/integration-tests/minimalist-project/pom.xml

File renamed without changes.

src/test/resources/owner-param-project/expected-output/utplsql/coverage-sonar-reporter.xml renamed to src/test/resources/integration-tests/owner-param-project/expected-output/utplsql/coverage-sonar-reporter.xml

File renamed without changes.

src/test/resources/owner-param-project/expected-output/utplsql/sonar-test-reporter.xml renamed to src/test/resources/integration-tests/owner-param-project/expected-output/utplsql/sonar-test-reporter.xml

File renamed without changes.

src/test/resources/owner-param-project/pom.xml renamed to src/test/resources/integration-tests/owner-param-project/pom.xml

File renamed without changes.

src/test/resources/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql renamed to src/test/resources/integration-tests/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql

File renamed without changes.

0 commit comments

Comments
 (0)