Skip to content
Permalink
Browse files

Add Option node to PCTBinaryDump / PCTBinaryLoad (#378)

  • Loading branch information...
gquerret committed Aug 26, 2019
1 parent 7ff870c commit 56e5c9dcb296ffa515900480fa28f35abad15f3d
@@ -40,6 +40,7 @@
private List<Pattern> patterns = new ArrayList<>();
private File dest = null;
private Path propath = null;
private List<PCTRunOption> options = null;

private int tblListID = -1;
private File tblListFile = null;
@@ -129,6 +130,13 @@ public void setDest(File dest) {
this.dest = dest;
}

public void addOption(PCTRunOption option) {
if (options == null) {
options = new ArrayList<>();
}
options.add(option);
}

/**
* Do the work
*
@@ -204,6 +212,17 @@ private ExecTask dumpTask(String table) {
// Output directory
exec.createArg().setValue(dest.getAbsolutePath());

if (options != null) {
for (PCTRunOption opt : options) {
if (opt.getName() == null) {
throw new BuildException("PCTRun.8"); //$NON-NLS-1$
}
exec.createArg().setValue(opt.getName());
if (opt.getValue() != null)
exec.createArg().setValue(opt.getValue());
}
}

return exec;
}

@@ -38,6 +38,7 @@
private int indexRebuildTimeout = 0;
private boolean rebuildIndexes = true;
private File paramFile = null;
private List<PCTRunOption> options = null;

public void addDB_Connection(PCTConnection dbConn) {
addDBConnection(dbConn);
@@ -100,6 +101,13 @@ public void setRebuildIndexes(boolean rebuildIndexes) {
this.rebuildIndexes = rebuildIndexes;
}

public void addOption(PCTRunOption option) {
if (options == null) {
options = new ArrayList<>();
}
options.add(option);
}

/**
* Do the work
*
@@ -156,6 +164,17 @@ private ExecTask loadTask(File binaryFile) {
exec.createArg().setValue(this.paramFile.getAbsolutePath());
}

if (options != null) {
for (PCTRunOption opt : options) {
if (opt.getName() == null) {
throw new BuildException("PCTRun.8"); //$NON-NLS-1$
}
exec.createArg().setValue(opt.getName());
if (opt.getValue() != null)
exec.createArg().setValue(opt.getValue());
}
}

return exec;
}
}
@@ -83,4 +83,15 @@ public void test6() {
assertFalse(f2.exists());
assertTrue(f3.exists());
}

@Test(groups = {"v11"})
public void test7() {
configureProject("PCTBinaryDump/test7/build.xml");
executeTarget("test");

File f1 = new File("PCTBinaryDump/test7/dump/Customer.bd");
File f2 = new File("PCTBinaryDump/test7/dump2/list.txt");
assertTrue(f1.exists());
assertTrue(f2.exists());
}
}
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<project name="PCTBinaryDump-test7">
<taskdef resource="PCT.properties" />

<target name="test">
<mkdir dir="db" />
<sports2000 destDir="db" dbName="sp2k" dlcHome="${DLC}" />
<mkdir dir="dump" />
<mkdir dir="dump2" />
<PCTBinaryDump dest="dump" dlcHome="${DLC}">
<Option name="-dumplist" value="dump2/list.txt" />
<PCTConnection dbName="sp2k" dbDir="db" singleUser="true" />
</PCTBinaryDump>
</target>

</project>

0 comments on commit 56e5c9d

Please sign in to comment.
You can’t perform that action at this time.