use of org.pentaho.platform.util.beans.ActionHarness in project pentaho-platform by pentaho.
the class ActionHarnessTest method testVarArgsActionSetValue.
@Test
public void testVarArgsActionSetValue() throws Exception {
TestVarArgsAction action = new TestVarArgsAction();
ActionHarness harness = new ActionHarness(action);
harness.setValue("message", "test message");
harness.setValue("undeclaredParam1", "undeclaredParam1 value");
harness.setValue("undeclaredParam2", "undeclaredParam2 value");
Assert.assertEquals("test message", harness.getValue("message"));
Assert.assertTrue(action.getVarArgs().containsKey("undeclaredParam1"));
Assert.assertTrue(action.getVarArgs().containsKey("undeclaredParam2"));
Assert.assertEquals("undeclaredParam1 value", action.getVarArgs().get("undeclaredParam1"));
Assert.assertEquals("undeclaredParam2 value", action.getVarArgs().get("undeclaredParam2"));
}
use of org.pentaho.platform.util.beans.ActionHarness in project pentaho-platform by pentaho.
the class ActionHarnessTest method testSetValueWithFormatter.
@Test
public void testSetValueWithFormatter() throws Exception {
TestAction action1 = new TestAction();
ActionHarness harness1 = new ActionHarness(action1);
PropertyNameFormatter f = new PropertyNameFormatter() {
public String format(String name) {
return "message";
}
};
harness1.setValue("THISWILLGETCLOBBERED", "test message action1", new EagerFailingCallback(), f);
Assert.assertEquals("test message action1", harness1.getValue("message"));
}
use of org.pentaho.platform.util.beans.ActionHarness in project pentaho-platform by pentaho.
the class ActionHarnessTest method testSetValueFailedConvertWitNonNullValue.
@Test(expected = Exception.class)
public void testSetValueFailedConvertWitNonNullValue() throws Exception {
TestAction action1 = new TestAction();
ActionHarness harness1 = new ActionHarness(action1);
harness1.setValue("count", new CustomParamType(), new EagerFailingCallback());
}
use of org.pentaho.platform.util.beans.ActionHarness in project pentaho-platform by pentaho.
the class ActionHarnessTest method testSetValue2.
@Test
public void testSetValue2() throws Exception {
TestAction action1 = new TestAction();
ActionHarness harness1 = new ActionHarness(action1);
harness1.setValue("message", "test message action1");
TestAction action2 = new TestAction();
ActionHarness harness2 = new ActionHarness(action2);
harness2.setValue("message", "test message action2");
Assert.assertEquals("test message action1", harness1.getValue("message"));
Assert.assertEquals("test message action2", harness2.getValue("message"));
}
use of org.pentaho.platform.util.beans.ActionHarness in project pentaho-platform by pentaho.
the class ActionHarnessTest method testSetValue.
@Test
public void testSetValue() throws Exception {
IAction action = new TestVarArgsAction();
ActionHarness harness = new ActionHarness(action);
harness.setValue("message", "test message");
Assert.assertEquals("test message", harness.getValue("message"));
}
Aggregations