Skip to content

Commit 9462988

Browse files
committed
updating trace ui to angular 2
fixing unit tests
1 parent 92cf7c4 commit 9462988

Some content is hidden

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

51 files changed

+402
-624
lines changed

marklogic-data-hub/src/main/java/com/marklogic/hub/DataHub.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,6 @@ public static int versionCompare(String v1, String v2) {
596596
return 0;
597597
}
598598

599-
600599
class EntitiesValidator extends ResourceManager {
601600
private static final String NAME = "validate";
602601

marklogic-data-hub/src/main/java/com/marklogic/hub/flow/RunFlowResponse.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@ public class RunFlowResponse {
77
public long errorCount = 0;
88
public List<String> completedItems;
99
public List<String> failedItems;
10+
11+
public String toString() {
12+
return "{totalCount: " + totalCount + ", errorCount: " + errorCount + ", completedItems: " + completedItems.size() + ", failedItems: " + failedItems.size() + "}";
13+
}
1014
}

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package com.marklogic.hub;
22

3-
import org.apache.commons.io.FileUtils;
43
import org.custommonkey.xmlunit.XMLUnit;
54
import org.junit.AfterClass;
65
import org.junit.BeforeClass;
76
import org.junit.Test;
87
import org.xml.sax.SAXException;
98

109
import javax.xml.parsers.ParserConfigurationException;
11-
import java.io.File;
1210
import java.io.IOException;
1311
import java.net.URISyntaxException;
1412
import java.net.URL;
@@ -20,13 +18,11 @@
2018

2119
public class DataHubInstallTest extends HubTestBase {
2220

23-
private static File projectPath = new File("ye-olde-project");
24-
2521
private static DataHub dataHub;
2622
@BeforeClass
2723
public static void setup() throws IOException {
2824
XMLUnit.setIgnoreWhitespace(true);
29-
dataHub = new DataHub(getHubConfig(projectPath.toString()));
25+
dataHub = new DataHub(getHubConfig());
3026

3127
InstallInfo installInfo = dataHub.isInstalled();
3228
if (installInfo.isInstalled()) {
@@ -38,9 +34,7 @@ public static void setup() throws IOException {
3834

3935
@AfterClass
4036
public static void teardown() throws IOException {
41-
dataHub = new DataHub(getHubConfig(projectPath.toString()));
42-
dataHub.uninstall();
43-
FileUtils.deleteDirectory(projectPath);
37+
uninstallHub();
4438
}
4539

4640
@Test

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class DataHubTest extends HubTestBase {
3838
private AdminManager am;
3939

4040
@TestSubject
41-
private DataHub dh = new DataHub(getHubConfig());
41+
private DataHub dh = getDataHub();
4242

4343
@BeforeClass
4444
public static void setup() {

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

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@
2323
import java.io.IOException;
2424
import java.nio.file.Path;
2525
import java.nio.file.Paths;
26+
import java.util.HashMap;
2627
import java.util.Vector;
2728
import java.util.concurrent.TimeUnit;
2829

2930
public class EndToEndTestSjsJson extends HubTestBase {
3031
private static final String ENTITY = "e2eentity";
3132
private static Path projectDir = Paths.get(".", "ye-olde-project");
32-
private static final int TEST_SIZE = 1000;
33-
private static final int BATCH_SIZE = 2;
33+
private static final int TEST_SIZE = 500;
34+
private static final int BATCH_SIZE = 10;
35+
private static FlowManager flowManager;
3436

3537
@BeforeClass
3638
public static void setup() throws IOException {
@@ -48,22 +50,19 @@ public static void setup() throws IOException {
4850
scaffolding.createFlow(ENTITY, "testharmonize", FlowType.HARMONIZE,
4951
PluginFormat.JAVASCRIPT, Format.JSON);
5052

51-
DataHub dh = new DataHub(getHubConfig());
52-
dh.clearUserModules();
53-
dh.installUserModules();
53+
getDataHub().clearUserModules();
54+
getDataHub().installUserModules();
55+
flowManager = new FlowManager(getHubConfig());
5456
}
5557

5658
@Before
5759
public void beforeEach() {
58-
DataHub dh = new DataHub(getHubConfig());
60+
clearDatabases(new String[]{HubConfig.DEFAULT_STAGING_NAME, HubConfig.DEFAULT_FINAL_NAME, HubConfig.DEFAULT_JOB_NAME, HubConfig.DEFAULT_TRACE_NAME});
5961

60-
dh.clearContent(HubConfig.DEFAULT_STAGING_NAME);
61-
dh.clearContent(HubConfig.DEFAULT_FINAL_NAME);
62-
dh.clearContent(HubConfig.DEFAULT_JOB_NAME);
63-
dh.clearContent(HubConfig.DEFAULT_TRACE_NAME);
64-
65-
installModule("/entities/" + ENTITY + "/harmonize/testharmonize/headers/headers.sjs", "e2e-test/sjs-flow/headers/headers.sjs");
66-
installModule("/entities/" + ENTITY + "/harmonize/testharmonize/triples/triples.sjs", "e2e-test/sjs-flow/triples/triples.sjs");
62+
HashMap<String, String> modules = new HashMap<>();
63+
modules.put("/entities/" + ENTITY + "/harmonize/testharmonize/headers/headers.sjs", "e2e-test/sjs-flow/headers/headers.sjs");
64+
modules.put("/entities/" + ENTITY + "/harmonize/testharmonize/triples/triples.sjs", "e2e-test/sjs-flow/triples/triples.sjs");
65+
installModules(modules);
6766
}
6867

6968
@AfterClass
@@ -73,9 +72,8 @@ public static void teardown() throws IOException {
7372

7473
@Test
7574
public void runFlows() throws IOException, ParserConfigurationException, SAXException, JSONException {
76-
FlowManager fm = new FlowManager(getHubConfig());
77-
FlowRunner flowRunner = fm.newFlowRunner();
78-
Flow harmonizeFlow = fm.getFlow(ENTITY, "testharmonize",
75+
FlowRunner flowRunner = flowManager.newFlowRunner();
76+
Flow harmonizeFlow = flowManager.getFlow(ENTITY, "testharmonize",
7977
FlowType.HARMONIZE);
8078

8179
DataMovementManager dataMovementManager = stagingClient.newDataMovementManager();
@@ -119,9 +117,8 @@ public void runFlows() throws IOException, ParserConfigurationException, SAXExce
119117
public void runFlowsWithFailures() throws IOException, ParserConfigurationException, SAXException, JSONException {
120118
installModule("/entities/" + ENTITY + "/harmonize/testharmonize/headers/headers.sjs", "e2e-test/sjs-flow/headers/headers-with-error.sjs");
121119

122-
FlowManager fm = new FlowManager(getHubConfig());
123-
FlowRunner flowRunner = fm.newFlowRunner();
124-
Flow harmonizeFlow = fm.getFlow(ENTITY, "testharmonize",
120+
FlowRunner flowRunner = flowManager.newFlowRunner();
121+
Flow harmonizeFlow = flowManager.getFlow(ENTITY, "testharmonize",
125122
FlowType.HARMONIZE);
126123

127124
DataMovementManager dataMovementManager = stagingClient.newDataMovementManager();
@@ -145,7 +142,6 @@ public void runFlowsWithFailures() throws IOException, ParserConfigurationExcept
145142
.withBatchSize(BATCH_SIZE)
146143
.withThreadCount(4)
147144
.onItemComplete((String jobId, String itemId) -> {
148-
logger.info(itemId);
149145
completed.add(itemId);
150146
})
151147
.onItemFailed((String jobId, String itemId) -> {
@@ -166,13 +162,13 @@ public void runFlowsWithFailures() throws IOException, ParserConfigurationExcept
166162
Assert.assertEquals(TEST_SIZE / BATCH_SIZE, node.get("successfulBatches").asInt());
167163
Assert.assertEquals(0, node.get("failedBatches").asInt());
168164
Assert.assertEquals("FINISHED_WITH_ERRORS", node.get("status").asText());
165+
169166
}
170167

171168
@Test
172169
public void runFlowsDontWait() throws IOException, ParserConfigurationException, SAXException, JSONException {
173-
FlowManager fm = new FlowManager(getHubConfig());
174-
FlowRunner flowRunner = fm.newFlowRunner();
175-
Flow harmonizeFlow = fm.getFlow(ENTITY, "testharmonize",
170+
FlowRunner flowRunner = flowManager.newFlowRunner();
171+
Flow harmonizeFlow = flowManager.getFlow(ENTITY, "testharmonize",
176172
FlowType.HARMONIZE);
177173

178174
DataMovementManager dataMovementManager = stagingClient.newDataMovementManager();

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

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.io.IOException;
2626
import java.nio.file.Path;
2727
import java.nio.file.Paths;
28+
import java.util.HashMap;
2829
import java.util.Vector;
2930
import java.util.concurrent.TimeUnit;
3031

@@ -35,6 +36,7 @@ public class EndToEndTestSjsXml extends HubTestBase {
3536
private static Path projectDir = Paths.get(".", "ye-olde-project");
3637
private static final int TEST_SIZE = 1000;
3738
private static final int BATCH_SIZE = 2;
39+
private static FlowManager flowManager;
3840

3941
@BeforeClass
4042
public static void setup() throws IOException {
@@ -54,22 +56,19 @@ public static void setup() throws IOException {
5456
scaffolding.createFlow(ENTITY, "testharmonize", FlowType.HARMONIZE,
5557
PluginFormat.JAVASCRIPT, Format.XML);
5658

57-
DataHub dh = new DataHub(getHubConfig());
58-
dh.clearUserModules();
59-
dh.installUserModules();
59+
getDataHub().clearUserModules();
60+
getDataHub().installUserModules();
61+
flowManager = new FlowManager(getHubConfig());
6062
}
6163

6264
@Before
6365
public void beforeEach() {
64-
DataHub dh = new DataHub(getHubConfig());
66+
clearDatabases(new String[]{HubConfig.DEFAULT_STAGING_NAME, HubConfig.DEFAULT_FINAL_NAME, HubConfig.DEFAULT_JOB_NAME, HubConfig.DEFAULT_TRACE_NAME});
6567

66-
dh.clearContent(HubConfig.DEFAULT_STAGING_NAME);
67-
dh.clearContent(HubConfig.DEFAULT_FINAL_NAME);
68-
dh.clearContent(HubConfig.DEFAULT_JOB_NAME);
69-
dh.clearContent(HubConfig.DEFAULT_TRACE_NAME);
70-
71-
installModule("/entities/" + ENTITY + "/harmonize/testharmonize/headers/headers.sjs", "e2e-test/sjs-flow/headers/headers.sjs");
72-
installModule("/entities/" + ENTITY + "/harmonize/testharmonize/triples/triples.sjs", "e2e-test/sjs-flow/triples/triples.sjs");
68+
HashMap<String, String> modules = new HashMap<>();
69+
modules.put("/entities/" + ENTITY + "/harmonize/testharmonize/headers/headers.sjs", "e2e-test/sjs-flow/headers/headers.sjs");
70+
modules.put("/entities/" + ENTITY + "/harmonize/testharmonize/triples/triples.sjs", "e2e-test/sjs-flow/triples/triples.sjs");
71+
installModules(modules);
7372
}
7473

7574
@AfterClass
@@ -79,9 +78,8 @@ public static void teardown() throws IOException {
7978

8079
@Test
8180
public void runFlows() throws IOException, ParserConfigurationException, SAXException {
82-
FlowManager fm = new FlowManager(getHubConfig());
83-
FlowRunner flowRunner = fm.newFlowRunner();
84-
Flow harmonizeFlow = fm.getFlow(ENTITY, "testharmonize",
81+
FlowRunner flowRunner = flowManager.newFlowRunner();
82+
Flow harmonizeFlow = flowManager.getFlow(ENTITY, "testharmonize",
8583
FlowType.HARMONIZE);
8684

8785
DataMovementManager dataMovementManager = stagingClient.newDataMovementManager();
@@ -125,9 +123,8 @@ public void runFlows() throws IOException, ParserConfigurationException, SAXExce
125123
public void runFlowsWithFailures() throws IOException, ParserConfigurationException, SAXException, JSONException {
126124
installModule("/entities/" + ENTITY + "/harmonize/testharmonize/headers/headers.sjs", "e2e-test/sjs-flow/headers/headers-with-error.sjs");
127125

128-
FlowManager fm = new FlowManager(getHubConfig());
129-
FlowRunner flowRunner = fm.newFlowRunner();
130-
Flow harmonizeFlow = fm.getFlow(ENTITY, "testharmonize",
126+
FlowRunner flowRunner = flowManager.newFlowRunner();
127+
Flow harmonizeFlow = flowManager.getFlow(ENTITY, "testharmonize",
131128
FlowType.HARMONIZE);
132129

133130
DataMovementManager dataMovementManager = stagingClient.newDataMovementManager();
@@ -151,7 +148,6 @@ public void runFlowsWithFailures() throws IOException, ParserConfigurationExcept
151148
.withBatchSize(BATCH_SIZE)
152149
.withThreadCount(4)
153150
.onItemComplete((String jobId, String itemId) -> {
154-
logger.info(itemId);
155151
completed.add(itemId);
156152
})
157153
.onItemFailed((String jobId, String itemId) -> {
@@ -176,9 +172,8 @@ public void runFlowsWithFailures() throws IOException, ParserConfigurationExcept
176172

177173
@Test
178174
public void runFlowsDontWait() throws IOException, ParserConfigurationException, SAXException, JSONException {
179-
FlowManager fm = new FlowManager(getHubConfig());
180-
FlowRunner flowRunner = fm.newFlowRunner();
181-
Flow harmonizeFlow = fm.getFlow(ENTITY, "testharmonize",
175+
FlowRunner flowRunner = flowManager.newFlowRunner();
176+
Flow harmonizeFlow = flowManager.getFlow(ENTITY, "testharmonize",
182177
FlowType.HARMONIZE);
183178

184179
DataMovementManager dataMovementManager = stagingClient.newDataMovementManager();

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

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.io.IOException;
2424
import java.nio.file.Path;
2525
import java.nio.file.Paths;
26+
import java.util.HashMap;
2627
import java.util.Vector;
2728
import java.util.concurrent.TimeUnit;
2829

@@ -31,6 +32,7 @@ public class EndToEndTestXqyJson extends HubTestBase {
3132
private static Path projectDir = Paths.get(".", "ye-olde-project");
3233
private static final int TEST_SIZE = 1000;
3334
private static final int BATCH_SIZE = 2;
35+
private static FlowManager flowManager;
3436

3537
@BeforeClass
3638
public static void setup() throws IOException {
@@ -48,22 +50,19 @@ public static void setup() throws IOException {
4850
scaffolding.createFlow(ENTITY, "testharmonize", FlowType.HARMONIZE,
4951
PluginFormat.XQUERY, Format.JSON);
5052

51-
DataHub dh = new DataHub(getHubConfig());
52-
dh.clearUserModules();
53-
dh.installUserModules();
53+
getDataHub().clearUserModules();
54+
getDataHub().installUserModules();
55+
flowManager = new FlowManager(getHubConfig());
5456
}
5557

5658
@Before
5759
public void beforeEach() {
58-
DataHub dh = new DataHub(getHubConfig());
60+
clearDatabases(new String[]{HubConfig.DEFAULT_STAGING_NAME, HubConfig.DEFAULT_FINAL_NAME, HubConfig.DEFAULT_JOB_NAME, HubConfig.DEFAULT_TRACE_NAME});
5961

60-
dh.clearContent(HubConfig.DEFAULT_STAGING_NAME);
61-
dh.clearContent(HubConfig.DEFAULT_FINAL_NAME);
62-
dh.clearContent(HubConfig.DEFAULT_JOB_NAME);
63-
dh.clearContent(HubConfig.DEFAULT_TRACE_NAME);
64-
65-
installModule("/entities/" + ENTITY + "/harmonize/testharmonize/headers/headers.xqy", "e2e-test/xqy-flow/headers/headers-json.xqy");
66-
installModule("/entities/" + ENTITY + "/harmonize/testharmonize/triples/triples.xqy", "e2e-test/xqy-flow/triples/triples.xqy");
62+
HashMap<String, String> modules = new HashMap<>();
63+
modules.put("/entities/" + ENTITY + "/harmonize/testharmonize/headers/headers.xqy", "e2e-test/xqy-flow/headers/headers-json.xqy");
64+
modules.put("/entities/" + ENTITY + "/harmonize/testharmonize/triples/triples.xqy", "e2e-test/xqy-flow/triples/triples.xqy");
65+
installModules(modules);
6766
}
6867

6968

@@ -74,9 +73,9 @@ public static void teardown() throws IOException {
7473

7574
@Test
7675
public void runFlowwithTriplesNodeStar() throws IOException, ParserConfigurationException, SAXException, JSONException {
77-
FlowManager fm = new FlowManager(getHubConfig());
78-
FlowRunner flowRunner = fm.newFlowRunner();
79-
Flow harmonizeFlow = fm.getFlow(ENTITY, "testharmonize",
76+
flowManager = new FlowManager(getHubConfig());
77+
FlowRunner flowRunner = flowManager.newFlowRunner();
78+
Flow harmonizeFlow = flowManager.getFlow(ENTITY, "testharmonize",
8079
FlowType.HARMONIZE);
8180

8281
DataMovementManager dataMovementManager = stagingClient.newDataMovementManager();
@@ -121,9 +120,8 @@ public void runFlowwithTriplesNodeStar() throws IOException, ParserConfiguration
121120
public void runFlowWithTriplesJsonArray() throws IOException, ParserConfigurationException, SAXException, JSONException {
122121
installModule("/entities/" + ENTITY + "/harmonize/testharmonize/triples/triples.xqy", "e2e-test/xqy-flow/triples/triples-json-array.xqy");
123122

124-
FlowManager fm = new FlowManager(getHubConfig());
125-
FlowRunner flowRunner = fm.newFlowRunner();
126-
Flow harmonizeFlow = fm.getFlow(ENTITY, "testharmonize",
123+
FlowRunner flowRunner = flowManager.newFlowRunner();
124+
Flow harmonizeFlow = flowManager.getFlow(ENTITY, "testharmonize",
127125
FlowType.HARMONIZE);
128126

129127
DataMovementManager dataMovementManager = stagingClient.newDataMovementManager();
@@ -168,9 +166,8 @@ public void runFlowWithTriplesJsonArray() throws IOException, ParserConfiguratio
168166
public void runFlowsWithFailures() throws IOException, ParserConfigurationException, SAXException, JSONException {
169167
installModule("/entities/" + ENTITY + "/harmonize/testharmonize/headers/headers.xqy", "e2e-test/xqy-flow/headers/headers-json-with-error.xqy");
170168

171-
FlowManager fm = new FlowManager(getHubConfig());
172-
FlowRunner flowRunner = fm.newFlowRunner();
173-
Flow harmonizeFlow = fm.getFlow(ENTITY, "testharmonize",
169+
FlowRunner flowRunner = flowManager.newFlowRunner();
170+
Flow harmonizeFlow = flowManager.getFlow(ENTITY, "testharmonize",
174171
FlowType.HARMONIZE);
175172

176173
DataMovementManager dataMovementManager = stagingClient.newDataMovementManager();
@@ -194,7 +191,6 @@ public void runFlowsWithFailures() throws IOException, ParserConfigurationExcept
194191
.withBatchSize(BATCH_SIZE)
195192
.withThreadCount(4)
196193
.onItemComplete((String jobId, String itemId) -> {
197-
logger.info(itemId);
198194
completed.add(itemId);
199195
})
200196
.onItemFailed((String jobId, String itemId) -> {
@@ -219,9 +215,8 @@ public void runFlowsWithFailures() throws IOException, ParserConfigurationExcept
219215

220216
@Test
221217
public void runFlowsDontWait() throws IOException, ParserConfigurationException, SAXException, JSONException {
222-
FlowManager fm = new FlowManager(getHubConfig());
223-
FlowRunner flowRunner = fm.newFlowRunner();
224-
Flow harmonizeFlow = fm.getFlow(ENTITY, "testharmonize",
218+
FlowRunner flowRunner = flowManager.newFlowRunner();
219+
Flow harmonizeFlow = flowManager.getFlow(ENTITY, "testharmonize",
225220
FlowType.HARMONIZE);
226221

227222
DataMovementManager dataMovementManager = stagingClient.newDataMovementManager();

0 commit comments

Comments
 (0)