Skip to content

Commit a9d78e4

Browse files
committed
Change default template for better alignment of output (#300)
See https://gitlab.com/oersi/oersi-etl/-/issues/238
1 parent 809bdfd commit a9d78e4

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

metafix/src/main/java/org/metafacture/metafix/MetafixListPaths.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*/
3131
@Description("Lists all paths found in the input records. These paths can be used in a Fix to address fields. Options: " +
3232
"count (output occurence frequency of each path, sorted by highest frequency first; default: true), " +
33-
"template (for formatting the internal triple structure; default: ${s}\t|\t${o} if count is true, else ${s})" +
33+
"template (for formatting the internal triple structure; default: ${o}\t|\t${s} if count is true, else ${s})" +
3434
"index (output individual repeated subfields and array elements with index numbers instead of '*'; default: false)")
3535
@In(StreamReceiver.class)
3636
@Out(String.class)

metafix/src/main/java/org/metafacture/metafix/MetafixListValues.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*/
3131
@Description("Lists all values found for the given path. The paths can be found using fix-list-paths. Options: " +
3232
"count (output occurence frequency of each value, sorted by highest frequency first; default: true)" +
33-
"template (for formatting the internal triple structure; default: ${s}\t|\t${o} if count is true, else ${s})")
33+
"template (for formatting the internal triple structure; default: ${o}\t|\t${s} if count is true, else ${s})")
3434
@In(StreamReceiver.class)
3535
@Out(String.class)
3636
@FluxCommand("fix-list-values")

metafix/src/main/java/org/metafacture/metafix/MetafixStreamAnalyzer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
*/
3737
/* package-private */ class MetafixStreamAnalyzer extends DefaultStreamPipe<ObjectReceiver<String>> {
3838

39-
private static final String DEFAULT_COUNTED_TEMPLATE = "${s}\t|\t${o}";
39+
private static final String DEFAULT_COUNTED_TEMPLATE = "${o}\t|\t${s}";
4040
private static final String DEFAULT_UNCOUNTED_TEMPLATE = "${s}";
4141

4242
private Metafix fix;

metafix/src/test/java/org/metafacture/metafix/MetafixListPathsTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public MetafixListPathsTest() {
4646
@Test
4747
public void testShouldListPaths() {
4848
verify(
49-
"c.*\t|\t3",
50-
"b.*\t|\t2",
51-
"a\t|\t1");
49+
"3\t|\tc.*",
50+
"2\t|\tb.*",
51+
"1\t|\ta");
5252
}
5353

5454
@Test
@@ -64,12 +64,12 @@ public void testShouldListPathsNoCount() {
6464
public void testShouldListPathsUseIndex() {
6565
lister.setIndex(true);
6666
verify(
67-
"a\t|\t1",
68-
"b.1\t|\t1",
69-
"b.2\t|\t1",
70-
"c.1\t|\t1",
71-
"c.2\t|\t1",
72-
"c.3\t|\t1");
67+
"1\t|\ta",
68+
"1\t|\tb.1",
69+
"1\t|\tb.2",
70+
"1\t|\tc.1",
71+
"1\t|\tc.2",
72+
"1\t|\tc.3");
7373
}
7474

7575
@Test
@@ -88,9 +88,9 @@ public void testShouldListPathsNoCountUseIndex() {
8888
@Test
8989
public void testShouldListPathsSortedByFrequency() {
9090
verify(
91-
"c.*\t|\t3",
92-
"b.*\t|\t2",
93-
"a\t|\t1");
91+
"3\t|\tc.*",
92+
"2\t|\tb.*",
93+
"1\t|\ta");
9494
}
9595

9696
private void processRecord() {

0 commit comments

Comments
 (0)