Skip to content

Commit 8fa9a52

Browse files
committed
optimizing tests
1 parent 34be9a9 commit 8fa9a52

File tree

15 files changed

+212
-330
lines changed

15 files changed

+212
-330
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ before_install:
77
- ./.travis/download.sh
88

99
script:
10-
- docker-compose build
1110
- docker-compose run marklogic

.travis/Dockerfile-ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ VOLUME /marklogic-data-hub
2929
ADD ./ /marklogic-data-hub
3030
WORKDIR /marklogic-data-hub
3131

32-
RUN ./gradlew tasks 2>&1 > /dev/null
32+
RUN ./gradlew build -x test 2>&1 > /dev/null
3333

3434
# Define default command (which avoids immediate shutdown)
3535
CMD /tmp/startml.sh && ./gradlew test

marklogic-data-hub/src/test/java/com/marklogic/hub/DataHubInstallTest.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,12 @@ public class DataHubInstallTest extends HubTestBase {
2222
@BeforeClass
2323
public static void setup() throws IOException {
2424
XMLUnit.setIgnoreWhitespace(true);
25-
dataHub = new DataHub(getHubConfig());
2625

27-
InstallInfo installInfo = dataHub.isInstalled();
26+
InstallInfo installInfo = getDataHub().isInstalled();
2827
if (installInfo.isInstalled()) {
29-
dataHub.uninstall();
28+
uninstallHub();
3029
}
31-
dataHub.initProject();
32-
dataHub.install();
33-
}
34-
35-
@AfterClass
36-
public static void teardown() throws IOException {
37-
uninstallHub();
30+
installHub();
3831
}
3932

4033
@Test

marklogic-data-hub/src/test/java/com/marklogic/hub/EntityManagerTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ public static void setup() throws IOException {
6262
installModules(modules);
6363
}
6464

65-
@AfterClass
66-
public static void teardown() throws IOException {
67-
uninstallHub();
68-
}
69-
7065
@Test
7166
public void testGetEntities() {
7267
EntityManager fm = new EntityManager(stagingClient);

marklogic-data-hub/src/test/java/com/marklogic/hub/FlowManagerTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ public static void setup() throws IOException {
7777
installModules(modules);
7878
}
7979

80-
@AfterClass
81-
public static void teardown() throws IOException {
82-
uninstallHub();
83-
}
84-
8580
@After
8681
public void afterEach() {
8782
finalDocMgr.delete("/employee1.xml");

marklogic-data-hub/src/test/java/com/marklogic/hub/HubTestBase.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,16 +217,15 @@ protected static HubConfig getHubConfig(String projectDir) {
217217
}
218218

219219
protected static void installHub() throws IOException {
220+
File projectDir = new File(PROJECT_PATH);
221+
if (!projectDir.isDirectory() || !projectDir.exists()) {
222+
getDataHub().initProject();
223+
}
224+
220225
if (!isInstalled) {
221226
getDataHub().install();
222227
isInstalled = true;
223228
}
224-
else {
225-
File projectDir = new File(PROJECT_PATH);
226-
if (!projectDir.isDirectory() || !projectDir.exists()) {
227-
getDataHub().initProject();
228-
}
229-
}
230229
}
231230

232231
protected static void uninstallHub() throws IOException {

marklogic-data-hub/src/test/java/com/marklogic/hub/TracingTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ public static void setup() throws IOException, URISyntaxException {
3030
dataHub.installUserModules(true);
3131
}
3232

33-
@AfterClass
34-
public static void teardown() throws IOException {
35-
uninstallHub();
36-
}
37-
3833
@Before
3934
public void beforeEach() {
4035
runInDatabase("cts:uris() ! xdmp:document-delete(.)", HubConfig.DEFAULT_FINAL_NAME);

ml-data-hub-plugin/src/test/groovy/com/marklogic/gradle/task/BaseTest.groovy

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ class BaseTest extends Specification {
1414

1515
public static boolean makeProperties = true;
1616

17-
final Logger log = LoggerFactory.getLogger(getClass())
18-
@Rule final TemporaryFolder testProjectDir = new TemporaryFolder()
19-
File buildFile
20-
File propertiesFile
17+
static final Logger log = LoggerFactory.getLogger(getClass())
18+
static final TemporaryFolder testProjectDir = new TemporaryFolder()
19+
static File buildFile
20+
static File propertiesFile
2121

22-
BuildResult runTask(String... task) {
22+
static BuildResult runTask(String... task) {
2323
log.info("DEBUG: running task " + task)
2424
return GradleRunner.create()
2525
.withProjectDir(testProjectDir.root)
@@ -46,7 +46,7 @@ class BaseTest extends Specification {
4646
return hubConfig.newStagingClient()
4747
}
4848

49-
void createBuildFile() {
49+
static void createBuildFile() {
5050
String version = new HubConfig(testProjectDir.toString()) .getJarVersion()
5151
buildFile = testProjectDir.newFile('build.gradle')
5252
buildFile << """
@@ -56,7 +56,7 @@ class BaseTest extends Specification {
5656
"""
5757
}
5858

59-
void createFullPropertiesFile() {
59+
static void createFullPropertiesFile() {
6060
propertiesFile = testProjectDir.newFile('gradle.properties')
6161
propertiesFile << """
6262
mlHost=localhost
@@ -103,7 +103,8 @@ class BaseTest extends Specification {
103103
"""
104104
}
105105

106-
def setup() {
106+
def setupSpec() {
107+
testProjectDir.create()
107108
createBuildFile()
108109
createFullPropertiesFile()
109110
}

ml-data-hub-plugin/src/test/groovy/com/marklogic/gradle/task/DisableDebuggingTaskTest.groovy

Lines changed: 0 additions & 41 deletions
This file was deleted.

ml-data-hub-plugin/src/test/groovy/com/marklogic/gradle/task/DisableTracingTaskTest.groovy

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)