Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#33 - make input and canonical optional #35

Merged
merged 1 commit into from
Feb 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 3 additions & 18 deletions data-hub/src/test/java/com/marklogic/hub/DataHubTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,12 @@
import org.junit.rules.ExpectedException;

public class DataHubTest extends HubTestBase {
private static String host;
private static int restPort;
private static String user;
private static String password;

@Rule
public final ExpectedException exception = ExpectedException.none();

@BeforeClass
public static void setup() {
Properties properties = getProperties();
host = properties.getProperty("mlHost");
restPort = Integer.parseInt(properties.getProperty("mlRestPort"));
user = properties.getProperty("mlUsername");
password = properties.getProperty("mlPassword");
}

@Test
public void testInstall() throws IOException {
DataHub dh = new DataHub(host, restPort, user, password);
DataHub dh = new DataHub(host, port, user, password);
if (dh.isInstalled()) {
// uninstall first
dh.uninstall();
Expand All @@ -59,9 +45,8 @@ public void testInstall() throws IOException {

@Test
public void testUnInstall() throws IOException {
DataHub dh = new DataHub(host, restPort, user, password);
DataHub dh = new DataHub(host, port, user, password);
if (false == dh.isInstalled()) {
// uninstall first
dh.install();
}
assertTrue(dh.isInstalled());
Expand All @@ -71,7 +56,7 @@ public void testUnInstall() throws IOException {

@Test
public void testValidateServer() throws ServerValidationException {
DataHub dh = new DataHub(host, restPort, user, password);
DataHub dh = new DataHub(host, port, user, password);
dh.validateServer();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ public class DomainManagerTest extends HubTestBase {
@BeforeClass
public static void setup() throws IOException {
XMLUnit.setIgnoreWhitespace(true);

DataHub dh = new DataHub(host, port, user, password);
if (false == dh.isInstalled()) {
dh.install();
}

DocumentMetadataHandle meta = new DocumentMetadataHandle();
meta.getCollections().add("tester");
installDoc("/incoming/employee1.xml", meta, getResource("flow-manager-test/input/employee1.xml"));
Expand Down
6 changes: 6 additions & 0 deletions data-hub/src/test/java/com/marklogic/hub/FlowManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ public class FlowManagerTest extends HubTestBase {
@BeforeClass
public static void setup() throws IOException {
XMLUnit.setIgnoreWhitespace(true);

DataHub dh = new DataHub(host, port, user, password);
if (false == dh.isInstalled()) {
dh.install();
}

DocumentMetadataHandle meta = new DocumentMetadataHandle();
meta.getCollections().add("tester");
installDoc("/incoming/employee1.xml", meta, getResource("flow-manager-test/input/employee1.xml"));
Expand Down
2 changes: 0 additions & 2 deletions data-hub/src/test/java/com/marklogic/hub/HubTestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ private static XMLDocumentManager init() {
}
catch (IOException e) {
System.err.println("Properties file not loaded.");
System.exit(1);
}

// try to load the local environment overrides file
Expand All @@ -80,7 +79,6 @@ private static XMLDocumentManager init() {
}
catch (IOException e) {
System.err.println("Properties file not loaded.");
System.exit(1);
}

host = properties.getProperty("mlHost");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,26 @@ public DomainModel createNewDomain(String userPluginDir, String domainName,
domainModel.setDomainName(domainName);
domainModel.setInputFlows(new ArrayList<>());
domainModel.setConformFlows(new ArrayList<>());
FileUtil.createFolderIfNecessary(userPluginDir + File.separator
+ FileUtil.DOMAINS_FOLDER, domainName);

String domainsPath = userPluginDir + File.separator + FileUtil.DOMAINS_FOLDER;
FileUtil.createFolderIfNecessary(domainsPath, domainName);

FlowModelFactory flowModelFactory = new FlowModelFactory(domainName);
String domainDirPath = userPluginDir + File.separator
+ FileUtil.DOMAINS_FOLDER + File.separator + domainName;
FlowModel inputFlow = flowModelFactory.createNewFlow(domainDirPath
+ File.separator + FlowType.INPUT, inputFlowName,
FlowType.INPUT);
FlowModel conformFlow = flowModelFactory.createNewFlow(domainDirPath
String domainDirPath = domainsPath + File.separator + domainName;
if (inputFlowName != null) {
FlowModel inputFlow = flowModelFactory.createNewFlow(domainDirPath
+ File.separator + FlowType.INPUT, inputFlowName,
FlowType.INPUT);
domainModel.getInputFlows().add(inputFlow);
}

if (conformFlowName != null) {
FlowModel conformFlow = flowModelFactory.createNewFlow(domainDirPath
+ File.separator + FlowType.CONFORM, conformFlowName,
FlowType.CONFORM);

domainModel.getInputFlows().add(inputFlow);
domainModel.getConformFlows().add(conformFlow);
domainModel.getConformFlows().add(conformFlow);
}

return domainModel;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,8 @@ public static FlowType getFlowType(String type) {
}
return null;
}

public String toString() {
return name;
}
}
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
<div class="modal fade" id="domainModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">Domain</h4>
</div>
<div class="modal-body" id="myModalBody">
<div class="row" ng-if="hasErrors">
<div class="col-md-12">
<ul class="alert alert-danger">
<li ng-repeat="error in errors">{{error}}</li>
</ul>
</div>
</div>
<div class="row">
<div id="details" class="col-xs-12 col-md-12">
<form ng-submit="saveDomain()">
<div class="form-group">
<label for="domainName">Domain Name</label>
<input class="form-control" name="domainName" type="text" ng-model="domainForm.domainName" placeHolder="Enter Domain Name" required="required"/>
</div>
<div class="form-group">
<label for="inputFlowName">Ingest Flow Name</label>
<input name="inputFlowName" type="text" ng-model="domainForm.inputFlowName" class="form-control" placeHolder="Enter Input Flow Name" required="required"/>
</div>
<div class="form-group">
<label for="conformFlowName">Conformance Flow Name</label>
<input name="conformFlowName" type="text" ng-model="domainForm.conformFlowName" class="form-control" placeHolder="Enter Conformance Flow Name" required="required"/>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<div class="col-xs-12 col-md-12">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-success" ng-click="saveDomain()">Submit</button>
</div>
</div>
</div>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">New Domain</h4>
</div>
<div class="modal-body" id="myModalBody">
<div class="row" ng-if="hasErrors">
<div class="col-md-12">
<ul class="alert alert-danger">
<li ng-repeat="error in errors">{{error}}</li>
</ul>
</div>
</div>
<div class="row">
<div id="details" class="col-xs-12 col-md-12">
<form ng-submit="saveDomain()">
<div class="form-group">
<label for="domainName">Domain Name</label>
<input class="form-control" name="domainName" type="text" ng-model="domainForm.domainName" placeHolder="Enter Domain Name" required="required"/>
</div>
<div class="form-group">
<label for="inputFlowName">Ingest Flow Name</label>
<input name="inputFlowName" type="text" ng-model="domainForm.inputFlowName" class="form-control" placeHolder="Enter Input Flow Name" required="required"/>
</div>
<div class="form-group">
<label for="conformFlowName">Conformance Flow Name</label>
<input name="conformFlowName" type="text" ng-model="domainForm.conformFlowName" class="form-control" placeHolder="Enter Conformance Flow Name" required="required"/>
</div>
</form>
</div>
</div>
</div>
<div class="modal-footer">
<div class="col-xs-12 col-md-12">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-success" ng-click="saveDomain()">Submit</button>
</div>
</div>
</div>
</div>
</div>
</div>
72 changes: 36 additions & 36 deletions quick-start/src/main/webapp/WEB-INF/static/top/modal/flowModal.html
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
<div class="modal fade" id="flowModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">Domain</h4>
</div>
<div class="modal-body" id="myModalBody">
<div class="row" ng-if="hasErrors">
<div class="col-md-12">
<ul class="alert alert-danger">
<li ng-repeat="error in errors">{{error}}</li>
</ul>
</div>
</div>
<div class="row">
<div id="details" class="col-xs-12 col-md-12">
<form ng-submit="saveFlow()">
<input name="domainName" type="hidden" ng-model="flowForm.domainName"/>
<input name="flowType" type="hidden" ng-model="flowForm.flowType"/>
<div class="form-group">
<label for="flowName">Flow Name</label>
<input class="form-control" name="flowName" type="text" ng-model="flowForm.flowName" placeHolder="Enter Flow Name" required="required"/>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<div class="col-xs-12 col-md-12">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-success" ng-click="saveFlow()">Submit</button>
</div>
</div>
</div>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">New Flow</h4>
</div>
<div class="modal-body" id="myModalBody">
<div class="row" ng-if="hasErrors">
<div class="col-md-12">
<ul class="alert alert-danger">
<li ng-repeat="error in errors">{{error}}</li>
</ul>
</div>
</div>
<div class="row">
<div id="details" class="col-xs-12 col-md-12">
<form ng-submit="saveFlow()">
<input name="domainName" type="hidden" ng-model="flowForm.domainName"/>
<input name="flowType" type="hidden" ng-model="flowForm.flowType"/>
<div class="form-group">
<label for="flowName">Flow Name</label>
<input class="form-control" name="flowName" type="text" ng-model="flowForm.flowName" placeHolder="Enter Flow Name" required="required"/>
</div>
</form>
</div>
</div>
</div>
<div class="modal-footer">
<div class="col-xs-12 col-md-12">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-success" ng-click="saveFlow()">Submit</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>