Search in sources :

Example 1 with ActionHarness

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"));
}
Also used : ActionHarness(org.pentaho.platform.util.beans.ActionHarness) Test(org.junit.Test)

Example 2 with ActionHarness

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"));
}
Also used : PropertyNameFormatter(org.pentaho.platform.util.beans.PropertyNameFormatter) ActionHarness(org.pentaho.platform.util.beans.ActionHarness) EagerFailingCallback(org.pentaho.platform.util.beans.BeanUtil.EagerFailingCallback) Test(org.junit.Test)

Example 3 with ActionHarness

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());
}
Also used : ActionHarness(org.pentaho.platform.util.beans.ActionHarness) EagerFailingCallback(org.pentaho.platform.util.beans.BeanUtil.EagerFailingCallback) Test(org.junit.Test)

Example 4 with ActionHarness

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"));
}
Also used : ActionHarness(org.pentaho.platform.util.beans.ActionHarness) Test(org.junit.Test)

Example 5 with ActionHarness

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"));
}
Also used : IAction(org.pentaho.platform.api.action.IAction) ActionHarness(org.pentaho.platform.util.beans.ActionHarness) Test(org.junit.Test)

Aggregations

ActionHarness (org.pentaho.platform.util.beans.ActionHarness)10 Test (org.junit.Test)8 EagerFailingCallback (org.pentaho.platform.util.beans.BeanUtil.EagerFailingCallback)5 PropertyNameFormatter (org.pentaho.platform.util.beans.PropertyNameFormatter)2 OutputStream (java.io.OutputStream)1 HashMap (java.util.HashMap)1 Locale (java.util.Locale)1 IAction (org.pentaho.platform.api.action.IAction)1 IPostProcessingAction (org.pentaho.platform.api.action.IPostProcessingAction)1 IStreamingAction (org.pentaho.platform.api.action.IStreamingAction)1 IVarArgsAction (org.pentaho.platform.api.action.IVarArgsAction)1 IParameterProvider (org.pentaho.platform.api.engine.IParameterProvider)1 ISourcesStreamEvents (org.pentaho.platform.api.repository2.unified.ISourcesStreamEvents)1 IStreamListener (org.pentaho.platform.api.repository2.unified.IStreamListener)1 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)1 ActionSequenceCompatibilityFormatter (org.pentaho.platform.engine.services.solution.ActionSequenceCompatibilityFormatter)1 SchedulerOutputPathResolver (org.pentaho.platform.scheduler2.quartz.SchedulerOutputPathResolver)1