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

fixing #41 path for xquery modules #42

Merged
merged 1 commit into from
Feb 18, 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
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,10 @@ declare function flow:get-flows(
cts:uri-match($DOMAINS-DIR || "*")
})
let $flows :=
for $flow in $uris[fn:matches(., $DOMAINS-DIR || $domain-name || "/(input|canonical)/[^/]+/$")]
let $name := fn:replace($flow, $DOMAINS-DIR || $domain-name || "/(input|canonical)/([^/]+)/$", "$2")
for $flow in $uris[fn:matches(., $DOMAINS-DIR || $domain-name || "/(input|conformance)/[^/]+/$")]
let $name := fn:replace($flow, $DOMAINS-DIR || $domain-name || "/(input|conformance)/([^/]+)/$", "$2")
return
flow:get-flow($domain-name, $name, (), $uris[fn:matches(., $DOMAINS-DIR || $domain-name || "/(input|canonical)/" || $name || "/.+")])
flow:get-flow($domain-name, $name, (), $uris[fn:matches(., $DOMAINS-DIR || $domain-name || "/(input|conformance)/" || $name || "/.+")])
return
<flows xmlns="http://marklogic.com/hub-in-a-box">
{
Expand Down
28 changes: 14 additions & 14 deletions data-hub/src/test/java/com/marklogic/hub/DomainManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ public static void setup() throws IOException {
installDoc("/incoming/employee1.xml", meta, getResource("flow-manager-test/input/employee1.xml"));
installDoc("/incoming/employee2.xml", meta, getResource("flow-manager-test/input/employee2.xml"));
runInModules(
"xdmp:directory-create(\"/ext/domains/test/my-test-flow1/collector/\")," +
"xdmp:directory-create(\"/ext/domains/test/my-test-flow1/headers/\")," +
"xdmp:directory-create(\"/ext/domains/test/my-test-flow1/triples/\")," +
"xdmp:directory-create(\"/ext/domains/test/my-test-flow1/content/\")," +
"xdmp:directory-create(\"/ext/domains/test/my-test-flow2/collector/\")," +
"xdmp:directory-create(\"/ext/domains/test/my-test-flow2/headers/\")," +
"xdmp:directory-create(\"/ext/domains/test/my-test-flow2/triples/\")," +
"xdmp:directory-create(\"/ext/domains/test/my-test-flow2/content/\")");
installModule("/ext/domains/test/my-test-flow1/collector/collector.xqy", "flow-manager-test/my-test-flow1/collector/collector.xqy");
installModule("/ext/domains/test/my-test-flow2/collector/collector.xqy", "flow-manager-test/my-test-flow1/collector/collector.xqy");
"xdmp:directory-create(\"/ext/domains/test/conformance/my-test-flow1/collector/\")," +
"xdmp:directory-create(\"/ext/domains/test/conformance/my-test-flow1/headers/\")," +
"xdmp:directory-create(\"/ext/domains/test/conformance/my-test-flow1/triples/\")," +
"xdmp:directory-create(\"/ext/domains/test/conformance/my-test-flow1/content/\")," +
"xdmp:directory-create(\"/ext/domains/test/conformance/my-test-flow2/collector/\")," +
"xdmp:directory-create(\"/ext/domains/test/conformance/my-test-flow2/headers/\")," +
"xdmp:directory-create(\"/ext/domains/test/conformance/my-test-flow2/triples/\")," +
"xdmp:directory-create(\"/ext/domains/test/conformance/my-test-flow2/content/\")");
installModule("/ext/domains/test/conformance/my-test-flow1/collector/collector.xqy", "flow-manager-test/my-test-flow1/collector/collector.xqy");
installModule("/ext/domains/test/conformance/my-test-flow2/collector/collector.xqy", "flow-manager-test/my-test-flow1/collector/collector.xqy");
}

@AfterClass
Expand Down Expand Up @@ -91,7 +91,7 @@ public void testGetDomains() {

ServerCollector c = (ServerCollector)flow1.getCollector();
assertEquals("xquery", c.getType());
assertEquals("/ext/domains/test/my-test-flow1/collector/collector.xqy", c.getModule());
assertEquals("/ext/domains/test/conformance/my-test-flow1/collector/collector.xqy", c.getModule());

ServerPlugin t = (ServerPlugin)flow1.getContentPlugin();
assertEquals("xquery", t.getType());
Expand All @@ -109,7 +109,7 @@ public void testGetDomains() {

c = (ServerCollector)flow1.getCollector();
assertEquals("xquery", c.getType());
assertEquals("/ext/domains/test/my-test-flow1/collector/collector.xqy", c.getModule());
assertEquals("/ext/domains/test/conformance/my-test-flow1/collector/collector.xqy", c.getModule());

t = (ServerPlugin)flow2.getContentPlugin();
assertEquals("xquery", t.getType());
Expand Down Expand Up @@ -137,7 +137,7 @@ public void testGetDomain() {

ServerCollector c = (ServerCollector)flow1.getCollector();
assertEquals("xquery", c.getType());
assertEquals("/ext/domains/test/my-test-flow1/collector/collector.xqy", c.getModule());
assertEquals("/ext/domains/test/conformance/my-test-flow1/collector/collector.xqy", c.getModule());

ServerPlugin t = (ServerPlugin)flow1.getContentPlugin();
assertEquals("xquery", t.getType());
Expand All @@ -154,7 +154,7 @@ public void testGetDomain() {

c = (ServerCollector)flow1.getCollector();
assertEquals("xquery", c.getType());
assertEquals("/ext/domains/test/my-test-flow1/collector/collector.xqy", c.getModule());
assertEquals("/ext/domains/test/conformance/my-test-flow1/collector/collector.xqy", c.getModule());

t = (ServerPlugin)flow2.getContentPlugin();
assertEquals("xquery", t.getType());
Expand Down
52 changes: 26 additions & 26 deletions data-hub/src/test/java/com/marklogic/hub/FlowManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,16 @@ public static void setup() throws IOException {
installDoc("/incoming/employee1.xml", meta, getResource("flow-manager-test/input/employee1.xml"));
installDoc("/incoming/employee2.xml", meta, getResource("flow-manager-test/input/employee2.xml"));
runInModules(
"xdmp:directory-create(\"/ext/domains/test/canonical/my-test-flow1/collector/\")," +
"xdmp:directory-create(\"/ext/domains/test/canonical/my-test-flow1/headers/\")," +
"xdmp:directory-create(\"/ext/domains/test/canonical/my-test-flow1/triples/\")," +
"xdmp:directory-create(\"/ext/domains/test/canonical/my-test-flow1/content/\")," +
"xdmp:directory-create(\"/ext/domains/test/canonical/my-test-flow2/collector/\")," +
"xdmp:directory-create(\"/ext/domains/test/canonical/my-test-flow2/headers/\")," +
"xdmp:directory-create(\"/ext/domains/test/canonical/my-test-flow2/triples/\")," +
"xdmp:directory-create(\"/ext/domains/test/canonical/my-test-flow2/content/\")");
installModule("/ext/domains/test/canonical/my-test-flow1/collector/collector.xqy", "flow-manager-test/my-test-flow1/collector/collector.xqy");
installModule("/ext/domains/test/canonical/my-test-flow2/collector/collector.xqy", "flow-manager-test/my-test-flow1/collector/collector.xqy");
"xdmp:directory-create(\"/ext/domains/test/conformance/my-test-flow1/collector/\")," +
"xdmp:directory-create(\"/ext/domains/test/conformance/my-test-flow1/headers/\")," +
"xdmp:directory-create(\"/ext/domains/test/conformance/my-test-flow1/triples/\")," +
"xdmp:directory-create(\"/ext/domains/test/conformance/my-test-flow1/content/\")," +
"xdmp:directory-create(\"/ext/domains/test/conformance/my-test-flow2/collector/\")," +
"xdmp:directory-create(\"/ext/domains/test/conformance/my-test-flow2/headers/\")," +
"xdmp:directory-create(\"/ext/domains/test/conformance/my-test-flow2/triples/\")," +
"xdmp:directory-create(\"/ext/domains/test/conformance/my-test-flow2/content/\")");
installModule("/ext/domains/test/conformance/my-test-flow1/collector/collector.xqy", "flow-manager-test/my-test-flow1/collector/collector.xqy");
installModule("/ext/domains/test/conformance/my-test-flow2/collector/collector.xqy", "flow-manager-test/my-test-flow1/collector/collector.xqy");
}

@AfterClass
Expand Down Expand Up @@ -106,16 +106,16 @@ public void testSimpleFlowFromXml() throws IOException, ParserConfigurationExcep

@Test
public void testEmptyFlow() throws IOException {
runInModules("xdmp:directory-create(\"/ext/domains/test/canonical/empty-flow/\")");
installModule("/ext/domains/test/canonical/empty-flow/collector/collector.xqy", "flow-manager-test/my-test-flow1/collector/collector.xqy");
runInModules("xdmp:directory-create(\"/ext/domains/test/conformance/empty-flow/\")");
installModule("/ext/domains/test/conformance/empty-flow/collector/collector.xqy", "flow-manager-test/my-test-flow1/collector/collector.xqy");

FlowManager fm = new FlowManager(client);
SimpleFlow flow1 = (SimpleFlow)fm.getFlow("test", "empty-flow");
assertEquals("empty-flow", flow1.getName());

ServerCollector c = (ServerCollector)flow1.getCollector();
assertEquals("xquery", c.getType());
assertEquals("/ext/domains/test/canonical/empty-flow/collector/collector.xqy", c.getModule());
assertEquals("/ext/domains/test/conformance/empty-flow/collector/collector.xqy", c.getModule());

ServerPlugin t = (ServerPlugin)flow1.getContentPlugin();
assertEquals("xquery", t.getType());
Expand All @@ -127,12 +127,12 @@ public void testEmptyFlow() throws IOException {
DefaultWriter w = (DefaultWriter)flow1.getWriter();
assertNotNull(w);

runInModules("xdmp:directory-delete(\"/ext/domains/test/canonical/empty-flow/\")");
runInModules("xdmp:directory-delete(\"/ext/domains/test/conformance/empty-flow/\")");
}

@Test
public void testSimpleFlowToXml() throws IOException, ParserConfigurationException, SAXException {
SimpleFlow flow = new SimpleFlow("test", "my-test-flow", "canonical");
SimpleFlow flow = new SimpleFlow("test", "my-test-flow", "conformance");
flow.setCollector(new QueryCollector());
flow.setContentPlugin(new ContentPlugin());
flow.setHeaderPlugin(new HeadersPlugin());
Expand All @@ -155,7 +155,7 @@ public void testGetFlows() {

ServerCollector c = (ServerCollector)flow1.getCollector();
assertEquals("xquery", c.getType());
assertEquals("/ext/domains/test/canonical/my-test-flow1/collector/collector.xqy", c.getModule());
assertEquals("/ext/domains/test/conformance/my-test-flow1/collector/collector.xqy", c.getModule());

ServerPlugin t = (ServerPlugin)flow1.getContentPlugin();
assertEquals("xquery", t.getType());
Expand All @@ -172,7 +172,7 @@ public void testGetFlows() {

c = (ServerCollector)flow1.getCollector();
assertEquals("xquery", c.getType());
assertEquals("/ext/domains/test/canonical/my-test-flow1/collector/collector.xqy", c.getModule());
assertEquals("/ext/domains/test/conformance/my-test-flow1/collector/collector.xqy", c.getModule());

t = (ServerPlugin)flow2.getContentPlugin();
assertEquals("xquery", t.getType());
Expand All @@ -193,7 +193,7 @@ public void getTestFlow() {

ServerCollector c = (ServerCollector)flow1.getCollector();
assertEquals("xquery", c.getType());
assertEquals("/ext/domains/test/canonical/my-test-flow1/collector/collector.xqy", c.getModule());
assertEquals("/ext/domains/test/conformance/my-test-flow1/collector/collector.xqy", c.getModule());

ServerPlugin t = (ServerPlugin)flow1.getContentPlugin();
assertEquals("xquery", t.getType());
Expand All @@ -218,8 +218,8 @@ public void testRunFlow() throws SAXException, IOException, ParserConfigurationE

@Test
public void testRunFlowWithHeader() throws SAXException, IOException, ParserConfigurationException, XMLStreamException {
installModule("/ext/domains/test/canonical/my-test-flow-with-header/collector/collector.xqy", "flow-manager-test/my-test-flow-with-header/collector/collector.xqy");
installModule("/ext/domains/test/canonical/my-test-flow-with-header/headers/headers.xqy", "flow-manager-test/my-test-flow-with-header/headers/headers.xqy");
installModule("/ext/domains/test/conformance/my-test-flow-with-header/collector/collector.xqy", "flow-manager-test/my-test-flow-with-header/collector/collector.xqy");
installModule("/ext/domains/test/conformance/my-test-flow-with-header/headers/headers.xqy", "flow-manager-test/my-test-flow-with-header/headers/headers.xqy");

assertEquals(2, getDocCount());
FlowManager fm = new FlowManager(client);
Expand All @@ -229,15 +229,15 @@ public void testRunFlowWithHeader() throws SAXException, IOException, ParserConf
assertXMLEqual(getXmlFromResource("flow-manager-test/conformed-with-header/conformed1.xml"), docMgr.read("/conformed/incoming/employee1.xml").next().getContent(new DOMHandle()).get() );
assertXMLEqual(getXmlFromResource("flow-manager-test/conformed-with-header/conformed2.xml"), docMgr.read("/conformed/incoming/employee2.xml").next().getContent(new DOMHandle()).get());

runInModules("xdmp:directory-delete(\"/ext/domains/test/canonical/my-test-flow-with-header/\")");
runInModules("xdmp:directory-delete(\"/ext/domains/test/conformance/my-test-flow-with-header/\")");
}

@Test
public void testRunFlowWithAll() throws SAXException, IOException, ParserConfigurationException, XMLStreamException {
installModule("/ext/domains/test/canonical/my-test-flow-with-all/collector/collector.xqy", "flow-manager-test/my-test-flow-with-all/collector/collector.xqy");
installModule("/ext/domains/test/canonical/my-test-flow-with-all/headers/headers.xqy", "flow-manager-test/my-test-flow-with-all/headers/headers.xqy");
installModule("/ext/domains/test/canonical/my-test-flow-with-all/content/content.xqy", "flow-manager-test/my-test-flow-with-all/content/content.xqy");
installModule("/ext/domains/test/canonical/my-test-flow-with-all/triples/triples.xqy", "flow-manager-test/my-test-flow-with-all/triples/triples.xqy");
installModule("/ext/domains/test/conformance/my-test-flow-with-all/collector/collector.xqy", "flow-manager-test/my-test-flow-with-all/collector/collector.xqy");
installModule("/ext/domains/test/conformance/my-test-flow-with-all/headers/headers.xqy", "flow-manager-test/my-test-flow-with-all/headers/headers.xqy");
installModule("/ext/domains/test/conformance/my-test-flow-with-all/content/content.xqy", "flow-manager-test/my-test-flow-with-all/content/content.xqy");
installModule("/ext/domains/test/conformance/my-test-flow-with-all/triples/triples.xqy", "flow-manager-test/my-test-flow-with-all/triples/triples.xqy");

assertEquals(2, getDocCount());
FlowManager fm = new FlowManager(client);
Expand All @@ -247,6 +247,6 @@ public void testRunFlowWithAll() throws SAXException, IOException, ParserConfigu
assertXMLEqual(getXmlFromResource("flow-manager-test/conformed-with-all/conformed1.xml"), docMgr.read("/conformed/incoming/employee1.xml").next().getContent(new DOMHandle()).get() );
assertXMLEqual(getXmlFromResource("flow-manager-test/conformed-with-all/conformed2.xml"), docMgr.read("/conformed/incoming/employee2.xml").next().getContent(new DOMHandle()).get());

runInModules("xdmp:directory-delete(\"/ext/domains/test/canonical/my-test-flow-with-all/\")");
runInModules("xdmp:directory-delete(\"/ext/domains/test/conformance/my-test-flow-with-all/\")");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public enum FlowType {

INPUT("input", "Input Flow"), CONFORM("conform", "Conformance Flow");
INPUT("input", "Input Flow"), CONFORM("conformance", "Conformance Flow");

public String name;
public String type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private List<Domain> getDomainsInServer() {
try {
DomainManager domainManager = getDomainManager();
domainsInServer = domainManager.getDomains();
} catch (MarkLogicServerException e) {
} catch (Exception e) {
// TODO catch this temporarily
// This should not return an error as the deploy to server should
// validate the plugins beforehand
Expand Down