Search in sources :

Example 1 with LocalPVFactory

use of org.csstudio.vtype.pv.local.LocalPVFactory in project org.csstudio.display.builder by kasemir.

the class RulesJythonScriptTest method testJythonScript.

@Test
public void testJythonScript() throws Exception {
    final DisplayModel display = ModelLoader.resolveAndLoadModel("../org.csstudio.display.builder.runtime.test/examples/dummy.opi", "rules_test.opi");
    final Widget widget = display.getChildren().parallelStream().filter(w -> w.getName().equals("Rectangle")).findFirst().get();
    System.out.println(widget);
    String pv_name = "loc://test2";
    PVPool.addPVFactory(new LocalPVFactory());
    final PV pv = PVPool.getPV(pv_name);
    pv.write(1);
// Set widget variable in script
// final ScriptSupport scripting = new ScriptSupport();
// final Script script = scripting.compile("../org.csstudio.display.builder.runtime.test/examples/updateText.py");
/*
        for (int run=0; run<10; ++run)
        {
            widget.setPropertyValue("text", "Initial");
            String text = widget.getPropertyValue("text");
            assertThat(text, equalTo("Initial"));
            script.submit(widget).get();
            assertThat(widget.getPropertyValue("text"), equalTo("Hello"));

            widget.setPropertyValue("text", "Initial");
            assertThat(widget.getPropertyValue("text"), equalTo("Initial"));
            script.submit(widget).get();
            assertThat(widget.getPropertyValue("text"), equalTo("Hello"));
        }

        scripting.close();
        */
}
Also used : LocalPVFactory(org.csstudio.vtype.pv.local.LocalPVFactory) DisplayModel(org.csstudio.display.builder.model.DisplayModel) PV(org.csstudio.vtype.pv.PV) Widget(org.csstudio.display.builder.model.Widget) Test(org.junit.Test)

Example 2 with LocalPVFactory

use of org.csstudio.vtype.pv.local.LocalPVFactory in project org.csstudio.display.builder by kasemir.

the class TestHelper method setup.

public static void setup() {
    PVPool.addPVFactory(new JCA_PVFactory());
    PVPool.addPVFactory(new LocalPVFactory());
    PVPool.addPVFactory(new SimPVFactory());
    PVPool.setDefaultType(LocalPVFactory.TYPE);
    // Logging
    final Level level = Level.FINE;
    Logger logger = Logger.getLogger("");
    logger.setLevel(level);
    for (Handler handler : logger.getHandlers()) handler.setLevel(level);
}
Also used : LocalPVFactory(org.csstudio.vtype.pv.local.LocalPVFactory) JCA_PVFactory(org.csstudio.vtype.pv.jca.JCA_PVFactory) Handler(java.util.logging.Handler) Level(java.util.logging.Level) SimPVFactory(org.csstudio.vtype.pv.sim.SimPVFactory) Logger(java.util.logging.Logger)

Aggregations

LocalPVFactory (org.csstudio.vtype.pv.local.LocalPVFactory)2 Handler (java.util.logging.Handler)1 Level (java.util.logging.Level)1 Logger (java.util.logging.Logger)1 DisplayModel (org.csstudio.display.builder.model.DisplayModel)1 Widget (org.csstudio.display.builder.model.Widget)1 PV (org.csstudio.vtype.pv.PV)1 JCA_PVFactory (org.csstudio.vtype.pv.jca.JCA_PVFactory)1 SimPVFactory (org.csstudio.vtype.pv.sim.SimPVFactory)1 Test (org.junit.Test)1