Skip to content

Commit

Permalink
#32 -- by making the constructor for SpringFlow varags I could get ri…
Browse files Browse the repository at this point in the history
…d of one <list> but practically not the other, because I'd need to write something more complex than <value> to create string beans; this is good enough for now
  • Loading branch information
Paul Houle authored and Paul Houle committed Oct 10, 2013
1 parent c2d27d8 commit ddaa51d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ontology2.haruhi.flows;

import java.util.Arrays;
import java.util.List;

import com.google.common.collect.Lists;
Expand All @@ -24,6 +25,10 @@ public class SpringFlow extends Flow {
public SpringFlow(List<SpringStep> springSteps) {
this.springSteps = springSteps;
}

public SpringFlow(SpringStep... springSteps) {
this(Arrays.asList(springSteps));
}

@Override
public List<FlowStep> generateSteps(List<String> flowArgs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,16 @@

<bean name="basekbNowFlow" class="com.ontology2.haruhi.flows.SpringFlow">
<constructor-arg>
<list>
<bean class="com.ontology2.haruhi.flows.JobStep">
<constructor-arg>
<list>
<value>'run'</value>
<value>'freebaseRDFPrefilter'</value>
<value>pos[0]+'freebase-rdf-'+pos[1]+'/'</value>
<value>tmpDir+'preprocessed/'+pos[1]+'/'</value>
</list>
</constructor-arg>
</bean>
</list>
<bean class="com.ontology2.haruhi.flows.JobStep">
<constructor-arg>
<list>
<value>'run'</value>
<value>'freebaseRDFPrefilter'</value>
<value>pos[0]+'freebase-rdf-'+pos[1]+'/'</value>
<value>tmpDir+'preprocessed/'+pos[1]+'/'</value>
</list>
</constructor-arg>
</bean>
</constructor-arg>
</bean>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ public class TestFlowBeans {
SpringStep step0=(SpringStep) steps.get(0);
List<String> args=step0.getStepArgs(flowArgs);

assertEquals(3,args.size());
assertEquals("freebaseRDFPrefilter",args.get(0));
assertEquals("s3n://freebase-dumps/freebase-rdf-1942-12-07-00-00/",args.get(1));
assertEquals("/preprocessed/1942-12-07-00-00/",args.get(2));
assertEquals(4,args.size());

int i=0;
assertEquals("run",args.get(i++));
assertEquals("freebaseRDFPrefilter",args.get(i++));
assertEquals("s3n://freebase-dumps/freebase-rdf-1942-12-07-00-00/",args.get(i++));
assertEquals("/preprocessed/1942-12-07-00-00/",args.get(i++));
}
}

0 comments on commit ddaa51d

Please sign in to comment.