diff --git a/ch.psi.fda/pom.xml b/ch.psi.fda/pom.xml index ab85943..7c192e5 100644 --- a/ch.psi.fda/pom.xml +++ b/ch.psi.fda/pom.xml @@ -149,12 +149,12 @@ i.snapshots Artifactory Snapshots - http://slsyoke1/artifactory/libs-snapshots-local + http://yoke/artifactory/libs-snapshots-local i.releases Atrifactory Releases - http://slsyoke1/artifactory/libs-releases-local + http://yoke/artifactory/libs-releases-local \ No newline at end of file diff --git a/ch.psi.fda/src/main/java/ch/psi/fda/core/loops/cr/ParallelCrlogic.java b/ch.psi.fda/src/main/java/ch/psi/fda/core/loops/cr/ParallelCrlogic.java index 40b575f..a116096 100644 --- a/ch.psi.fda/src/main/java/ch/psi/fda/core/loops/cr/ParallelCrlogic.java +++ b/ch.psi.fda/src/main/java/ch/psi/fda/core/loops/cr/ParallelCrlogic.java @@ -172,7 +172,8 @@ public class ParallelCrlogic implements ActionLoop { try { bf.get(); } catch (ExecutionException e) { - logger.log(Level.WARNING, "Something went wrong while waiting for crthreads to finish", e); + logger.log(Level.WARNING, "Something went wrong while waiting for crthreads to finish"); + throw new RuntimeException(e); } } diff --git a/ch.psi.fda/src/test/java/ch/psi/fda/TestConfiguration.java b/ch.psi.fda/src/test/java/ch/psi/fda/TestConfiguration.java new file mode 100644 index 0000000..6125c0c --- /dev/null +++ b/ch.psi.fda/src/test/java/ch/psi/fda/TestConfiguration.java @@ -0,0 +1,102 @@ +/** + * + * Copyright 2012 Paul Scherrer Institute. All rights reserved. + * + * This code is free software: you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) any + * later version. + * + * This code is distributed in the hope that it will be useful, but without any + * warranty; without even the implied warranty of merchantability or fitness for + * a particular purpose. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this code. If not, see . + * + */ +package ch.psi.fda; + +/** + * @author ebner + * + */ +public class TestConfiguration { + private static final TestConfiguration instance = new TestConfiguration(); + + private final String otfPrefix = "MTEST-HW3-OTFX"; + private final String crlogicPrefix = "MTEST-HW3-CRL"; + private final String prefixScaler = "MTEST-HW3:JS"; + private final String server = "yoke.psi.ch"; + private final String share = "/usr/local/nfsshare"; + private final String smbShare = "smb://:@"+server+"/otftemp/"; // It is important to have the last slash / ! + + private final String motor1 = "MTEST-HW3:MOT1"; + private final String analogIn1 = "MTEST-HW3-AI1:AI_01"; + + private TestConfiguration(){ + } + + public static TestConfiguration getInstance(){ + return instance; + } + + /** + * @return the prefix + */ + public String getCrlogicPrefix() { + return crlogicPrefix; + } + + /** + * @return the prefixScaler + */ + public String getPrefixScaler() { + return prefixScaler; + } + + /** + * @return the server + */ + public String getServer() { + return server; + } + + /** + * @return the share + */ + public String getShare() { + return share; + } + + /** + * @return the smbShare + */ + public String getSmbShare() { + return smbShare; + } + + /** + * @return the motor1 + */ + public String getMotor1() { + return motor1; + } + + /** + * @return the analogIn1 + */ + public String getAnalogIn1() { + return analogIn1; + } + + /** + * @return the otfPrefix + */ + public String getOtfPrefix() { + return otfPrefix; + } + + +} diff --git a/ch.psi.fda/src/test/java/ch/psi/fda/core/loops/DistributedFileTest.java b/ch.psi.fda/src/test/java/ch/psi/fda/core/loops/DistributedFileTest.java index bb17272..d64fbb0 100644 --- a/ch.psi.fda/src/test/java/ch/psi/fda/core/loops/DistributedFileTest.java +++ b/ch.psi.fda/src/test/java/ch/psi/fda/core/loops/DistributedFileTest.java @@ -27,6 +27,8 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import ch.psi.fda.TestConfiguration; + /** * @author ebner * @@ -45,7 +47,7 @@ public class DistributedFileTest { @Before public void setUp() throws Exception { file = new DistributedFile("src/test/resources"); - smbfile = new DistributedFile("smb://:@slsyoke1.psi.ch/otftemp/"); + smbfile = new DistributedFile(TestConfiguration.getInstance().getSmbShare()); } /** diff --git a/ch.psi.fda/src/test/java/ch/psi/fda/core/loops/OTFLoopTest.java b/ch.psi.fda/src/test/java/ch/psi/fda/core/loops/OTFLoopTest.java index 6251b99..11b280e 100644 --- a/ch.psi.fda/src/test/java/ch/psi/fda/core/loops/OTFLoopTest.java +++ b/ch.psi.fda/src/test/java/ch/psi/fda/core/loops/OTFLoopTest.java @@ -31,6 +31,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import ch.psi.fda.TestConfiguration; import ch.psi.fda.core.actors.OTFActuator; import ch.psi.fda.core.loops.OTFLoop; import ch.psi.fda.core.messages.ControlMessage; @@ -82,12 +83,7 @@ public class OTFLoopTest { } - private static final String motor = "MTEST-HW3:MOT1"; - private static final String channelPrefix = "MTEST-HW3-OTFX"; - private static final String channelAnalogIn = "MTEST-HW3-AI1:AI_01"; - private static final String server = "slsyoke1.psi.ch"; - private static final String share = "/usr/local/nfsshare"; - private static final String smbShare = "smb://:@slsyoke1.psi.ch/otftemp/"; + private static final TestConfiguration configuration = TestConfiguration.getInstance(); private OTFLoop loopZigZag; @@ -100,18 +96,18 @@ public class OTFLoopTest { @Before public void setUp() throws Exception { - statusChannel = ChannelBeanFactory.getFactory().createChannelBean(Integer.class, channelPrefix+":USTAT", false); + statusChannel = ChannelBeanFactory.getFactory().createChannelBean(Integer.class, configuration.getOtfPrefix()+":USTAT", false); - OTFActuator actor = new OTFActuator("id", motor, null, 0, 8, 0.5, 0.5, 0); + OTFActuator actor = new OTFActuator("id", configuration.getMotor1(), null, 0, 8, 0.5, 0.5, 0); OTFReadbackSensor s1 = new OTFReadbackSensor("id0"); OTFScalerChannelSensor s2 = new OTFScalerChannelSensor("id1", 0); OTFScalerChannelSensor s3 = new OTFScalerChannelSensor("id2", 1); MillisecondTimestampSensor s4 = new MillisecondTimestampSensor("id3"); - OTFNamedChannelSensor s5 = new OTFNamedChannelSensor("id4", channelAnalogIn); + OTFNamedChannelSensor s5 = new OTFNamedChannelSensor("id4", configuration.getAnalogIn1()); // ZigZag loop - loopZigZag = new OTFLoop(channelPrefix, server, share, smbShare, true); + loopZigZag = new OTFLoop(configuration.getOtfPrefix(), configuration.getServer(), configuration.getShare(), configuration.getSmbShare(), true); loopZigZag.setActor(actor); loopZigZag.getSensors().add(s1); loopZigZag.getSensors().add(s2); @@ -121,7 +117,7 @@ public class OTFLoopTest { // Normal loop - loop = new OTFLoop(channelPrefix, server, share, smbShare, false); + loop = new OTFLoop(configuration.getOtfPrefix(), configuration.getServer(), configuration.getShare(), configuration.getSmbShare(), false); loop.setActor(actor); loop.getSensors().add(s1); loop.getSensors().add(s2); diff --git a/ch.psi.fda/src/test/java/ch/psi/fda/core/loops/SambaTest.java b/ch.psi.fda/src/test/java/ch/psi/fda/core/loops/SambaTest.java index bc69a24..faa4b2f 100644 --- a/ch.psi.fda/src/test/java/ch/psi/fda/core/loops/SambaTest.java +++ b/ch.psi.fda/src/test/java/ch/psi/fda/core/loops/SambaTest.java @@ -53,7 +53,7 @@ public class SambaTest { // smbShare = "smb://x05laop:mXAS@x05la/x05laop/Data1/otfTmp/"; smbShare = "smb://x05la.psi.ch/x05laop/Data1/otfTmp/"; // smbShare = "smb://x05laop:mXAS@x05la/x05laop/Data1/otfTmp/000000.txt.lock"; -// smbShare = "smb://:@slsyoke1.psi.ch/otftemp/"; +// smbShare = "smb://:@yoke.psi.ch/otftemp/"; // NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("x05laop:mXAS"); // SmbFile tmpDir = new SmbFile(smbShare,auth); SmbFile tmpDir = new SmbFile(smbShare); diff --git a/ch.psi.fda/src/test/java/ch/psi/fda/core/loops/cr/ParallelCrlogicTest.java b/ch.psi.fda/src/test/java/ch/psi/fda/core/loops/cr/ParallelCrlogicTest.java index f9f5ec8..571ff29 100644 --- a/ch.psi.fda/src/test/java/ch/psi/fda/core/loops/cr/ParallelCrlogicTest.java +++ b/ch.psi.fda/src/test/java/ch/psi/fda/core/loops/cr/ParallelCrlogicTest.java @@ -31,6 +31,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import ch.psi.fda.TestConfiguration; import ch.psi.fda.core.Sensor; import ch.psi.fda.core.actors.OTFActuator; import ch.psi.fda.core.messages.EndOfStreamMessage; @@ -67,14 +68,10 @@ public class ParallelCrlogicTest { @Test(timeout=60000) public void testExecute() throws InterruptedException, CAException{ - String prefix = "MTEST-HW3-CRL"; - String prefixScaler = "MTEST-HW3:JS"; - String server = "yoke.psi.ch"; - String share = "/usr/local/nfsshare"; - String smbShare = "smb://:@"+server+"/otftemp/"; + TestConfiguration c = TestConfiguration.getInstance(); + boolean zigZag = false; - String name = "MTEST-HW3:MOT1"; String readback = null; double start = 0; double end = 2; @@ -83,8 +80,8 @@ public class ParallelCrlogicTest { double additionalBacklash = 0; List sensors = new ArrayList(); - ChannelAccessDoubleSensor s2 = new ChannelAccessDoubleSensor("mot1", name+".RVAL"); - ChannelAccessDoubleSensor s1 = new ChannelAccessDoubleSensor("mot1", name+".RBV"); + ChannelAccessDoubleSensor s2 = new ChannelAccessDoubleSensor("mot1", c.getMotor1()+".RVAL"); + ChannelAccessDoubleSensor s1 = new ChannelAccessDoubleSensor("mot1", c.getMotor1()+".RBV"); sensors.add(s1); sensors.add(s2); @@ -92,8 +89,8 @@ public class ParallelCrlogicTest { ScrlogicLoop scrlogic = new ScrlogicLoop(sensors); - CrlogicLoop crlogic = new CrlogicLoop(prefix, server, share, smbShare, zigZag); - crlogic.setActor(new OTFActuator("cmot", name, readback, start, end, stepSize, integrationTime, additionalBacklash)); + CrlogicLoop crlogic = new CrlogicLoop(c.getCrlogicPrefix(), c.getServer(), c.getShare(), c.getSmbShare(), zigZag); + crlogic.setActor(new OTFActuator("cmot", c.getMotor1(), readback, start, end, stepSize, integrationTime, additionalBacklash)); crlogic.getSensors().add(new OTFNamedChannelSensor("trigger", "TRIGGER0")); crlogic.getSensors().add(new OTFScalerChannelSensor("scaler0", 0)); crlogic.getSensors().add(new OTFScalerChannelSensor("scaler1", 1)); @@ -102,7 +99,7 @@ public class ParallelCrlogicTest { // Initialize scaler template VSC16ScalerChannelsTemplate scalertemplate = new VSC16ScalerChannelsTemplate(); - ChannelBeanFactory.getFactory().createChannelBeans(scalertemplate, prefixScaler); + ChannelBeanFactory.getFactory().createChannelBeans(scalertemplate, c.getPrefixScaler()); ParallelCrlogic pcrlogic = new ParallelCrlogic(crlogic, scrlogic); diff --git a/ch.psi.fda/src/test/resources/home/config/fda.properties b/ch.psi.fda/src/test/resources/home/config/fda.properties index a4a79fe..67a4e03 100644 --- a/ch.psi.fda/src/test/resources/home/config/fda.properties +++ b/ch.psi.fda/src/test/resources/home/config/fda.properties @@ -3,9 +3,9 @@ ch.psi.fda.aq.data.filePrefix=${yyyy_MM}/${yyyyMMdd}/${yyyyMMddHHmmss}_${name}/$ # OTF scan related configuration ch.psi.fda.aq.otf.channelPrefix=MTEST-HW3-OTFX -ch.psi.fda.aq.otf.nfsServer=slsyoke1.psi.ch +ch.psi.fda.aq.otf.nfsServer=yoke.psi.ch ch.psi.fda.aq.otf.nfsShare=/usr/local/nfsshare -ch.psi.fda.aq.otf.smbShare=smb://:@sdc.psi.ch/otftemp/ +ch.psi.fda.aq.otf.smbShare=smb://:@yoke.psi.ch/otftemp/ ch.psi.fda.aq.otf.useCrlogic=true ch.psi.fda.aq.otf.crlogicPrefix=MTEST-HW3-CRL