Skip to content
Snippets Groups Projects
Commit ab398b9b authored by PICHON's avatar PICHON
Browse files

Correction on the auto-input. AutoInput executor was still alive after an...

Correction on the auto-input. AutoInput executor was still alive after an init. Adding the possibility to express the precision in percent. And to check the difference between the last read value or the last write value (default).
parent 04fad293
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<groupId>fr.soleil.deviceservers</groupId> <groupId>fr.soleil.deviceservers</groupId>
<artifactId>TangoParser</artifactId> <artifactId>TangoParser</artifactId>
<version>3.3.5</version> <version>3.3.6</version>
<name>TangoParser</name> <name>TangoParser</name>
<description>TangoParser Device</description> <description>TangoParser Device</description>
......
...@@ -10,7 +10,6 @@ import fr.esrf.Tango.AttrWriteType; ...@@ -10,7 +10,6 @@ import fr.esrf.Tango.AttrWriteType;
import fr.esrf.Tango.DevFailed; import fr.esrf.Tango.DevFailed;
import fr.esrf.Tango.DispLevel; import fr.esrf.Tango.DispLevel;
import fr.esrf.TangoDs.TangoConst; import fr.esrf.TangoDs.TangoConst;
import fr.soleil.tango.clientapi.util.TypeConversionUtil;
public class AutoInputActivatorAttribute implements IAttributeBehavior { public class AutoInputActivatorAttribute implements IAttributeBehavior {
private final AttributeValue value = new AttributeValue(); private final AttributeValue value = new AttributeValue();
...@@ -22,8 +21,8 @@ public class AutoInputActivatorAttribute implements IAttributeBehavior { ...@@ -22,8 +21,8 @@ public class AutoInputActivatorAttribute implements IAttributeBehavior {
config.setName(name); config.setName(name);
config.setTangoType(TangoConst.Tango_DEV_BOOLEAN, AttrDataFormat.SCALAR); config.setTangoType(TangoConst.Tango_DEV_BOOLEAN, AttrDataFormat.SCALAR);
config.setWritable(AttrWriteType.READ_WRITE); config.setWritable(AttrWriteType.READ_WRITE);
config.setDispLevel(DispLevel.EXPERT); config.setDispLevel(DispLevel.OPERATOR);
value.setValue(TypeConversionUtil.castToType(config.getType(), activated)); //value.setValue(TypeConversionUtil.castToType(config.getType(), activated));
this.autoInputAttributeManager = autoInputAttributeManager; this.autoInputAttributeManager = autoInputAttributeManager;
} }
...@@ -34,6 +33,8 @@ public class AutoInputActivatorAttribute implements IAttributeBehavior { ...@@ -34,6 +33,8 @@ public class AutoInputActivatorAttribute implements IAttributeBehavior {
@Override @Override
public AttributeValue getValue() throws DevFailed { public AttributeValue getValue() throws DevFailed {
this.value.setValue(autoInputAttributeManager.isRunning());
//return autoInputAttributeManager.isRunning();
return value; return value;
} }
...@@ -56,7 +57,7 @@ public class AutoInputActivatorAttribute implements IAttributeBehavior { ...@@ -56,7 +57,7 @@ public class AutoInputActivatorAttribute implements IAttributeBehavior {
} else { } else {
autoInputAttributeManager.stop(); autoInputAttributeManager.stop();
} }
this.value.setValue(newValue); //this.value.setValue(newValue);
} }
} }
......
package fr.soleil.tango.parser.autoinput; package fr.soleil.tango.parser.autoinput;
import java.lang.reflect.Array; import java.lang.reflect.Array;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -16,7 +17,8 @@ public class AutoInputAttributeManager { ...@@ -16,7 +17,8 @@ public class AutoInputAttributeManager {
private class TaskRunner implements Runnable { private class TaskRunner implements Runnable {
private Object prevValue = null; private Object prevValueRead = null;
private Object prevValueWrite = null;
private boolean numeric = false; private boolean numeric = false;
private boolean array = false; private boolean array = false;
...@@ -24,6 +26,8 @@ public class AutoInputAttributeManager { ...@@ -24,6 +26,8 @@ public class AutoInputAttributeManager {
public void run() { public void run() {
Object newValue = readValue(); Object newValue = readValue();
Object prevValue = properties.isLastRead() ? prevValueRead : prevValueWrite;
if (prevValue != null && newValue != null) { if (prevValue != null && newValue != null) {
boolean equal = false; boolean equal = false;
if (array) { if (array) {
...@@ -39,6 +43,7 @@ public class AutoInputAttributeManager { ...@@ -39,6 +43,7 @@ public class AutoInputAttributeManager {
} }
if (!equal) { if (!equal) {
writeValue(newValue); writeValue(newValue);
prevValueWrite = newValue;
} }
} else if (newValue != null) { } else if (newValue != null) {
// First value at start or after a shutdown. // First value at start or after a shutdown.
...@@ -54,10 +59,11 @@ public class AutoInputAttributeManager { ...@@ -54,10 +59,11 @@ public class AutoInputAttributeManager {
} }
if (newValue != null) { if (newValue != null) {
writeValue(newValue); writeValue(newValue);
prevValueWrite = newValue;
} }
} }
prevValue = newValue; prevValueRead = newValue;
} }
} }
...@@ -67,7 +73,8 @@ public class AutoInputAttributeManager { ...@@ -67,7 +73,8 @@ public class AutoInputAttributeManager {
private final IWriteLockAttributeBehaviour attribute; private final IWriteLockAttributeBehaviour attribute;
private final AutoInputProperties properties; private final AutoInputProperties properties;
public AutoInputAttributeManager(final IWriteLockAttributeBehaviour attribute, final AutoInputProperties properties) { public AutoInputAttributeManager(final IWriteLockAttributeBehaviour attribute,
final AutoInputProperties properties) {
super(); super();
this.attribute = attribute; this.attribute = attribute;
this.properties = properties; this.properties = properties;
...@@ -85,9 +92,14 @@ public class AutoInputAttributeManager { ...@@ -85,9 +92,14 @@ public class AutoInputAttributeManager {
if (numeric) { if (numeric) {
double newValDbl = ((Number) newValue).doubleValue(); double newValDbl = ((Number) newValue).doubleValue();
double prevValDbl = ((Number) prevValue).doubleValue(); double prevValDbl = ((Number) prevValue).doubleValue();
double absDiff = Math.abs(newValDbl - prevValDbl); double diff = newValDbl - prevValDbl;
if (properties.isPercentPrecision()) {
double pctDiff = Math.abs(diff / prevValDbl);
equal = pctDiff < properties.getPrecision();
} else {
double absDiff = Math.abs(diff);
equal = absDiff < properties.getPrecision(); equal = absDiff < properties.getPrecision();
}
} else { } else {
// For boolean or strings, precision is useless. // For boolean or strings, precision is useless.
equal = prevValue.equals(newValue); equal = prevValue.equals(newValue);
...@@ -124,7 +136,7 @@ public class AutoInputAttributeManager { ...@@ -124,7 +136,7 @@ public class AutoInputAttributeManager {
} }
} }
public void start() { public synchronized void start() {
if (taskRunner == null) { if (taskRunner == null) {
attribute.blockExternalWriting(); attribute.blockExternalWriting();
long periodMS = (long) (properties.getPoolingPeriod() * 1000.0 + 0.5); long periodMS = (long) (properties.getPoolingPeriod() * 1000.0 + 0.5);
...@@ -135,7 +147,11 @@ public class AutoInputAttributeManager { ...@@ -135,7 +147,11 @@ public class AutoInputAttributeManager {
} }
} }
public void stop() { public synchronized boolean isRunning() {
return executor != null;
}
public synchronized void stop() {
if (executor != null) { if (executor != null) {
attribute.releaseExternalWriting(); attribute.releaseExternalWriting();
executor.shutdown(); executor.shutdown();
......
...@@ -12,6 +12,8 @@ public class AutoInputProperties { ...@@ -12,6 +12,8 @@ public class AutoInputProperties {
private boolean activated; private boolean activated;
private double poolingPeriod; private double poolingPeriod;
private double precision; private double precision;
private boolean percentPrecision;
private boolean lastRead;
public static List<AutoInputProperties> parseProperty(String[] tangoParserProperty) { public static List<AutoInputProperties> parseProperty(String[] tangoParserProperty) {
List<AutoInputProperties> result = new ArrayList<>(); List<AutoInputProperties> result = new ArrayList<>();
...@@ -40,7 +42,15 @@ public class AutoInputProperties { ...@@ -40,7 +42,15 @@ public class AutoInputProperties {
} }
double precision = 0.0; double precision = 0.0;
boolean percentPrecision = false;
boolean lastRead = false;
if (splittedLine.length > 3) { if (splittedLine.length > 3) {
String precisionStr = splittedLine[3].trim();
if (precisionStr.length() > 0) {
if (precisionStr.charAt(precisionStr.length() - 1) == '%') {
precisionStr = precisionStr.substring(0, precisionStr.length() - 1);
percentPrecision = true;
}
try { try {
precision = Double.parseDouble(splittedLine[3].trim()); precision = Double.parseDouble(splittedLine[3].trim());
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {
...@@ -49,10 +59,17 @@ public class AutoInputProperties { ...@@ -49,10 +59,17 @@ public class AutoInputProperties {
error = true; error = true;
} }
} }
if (splittedLine.length > 4) {
String lastReadStr = splittedLine[4].trim();
if (lastReadStr.length() > 0) {
lastRead = lastReadStr.toLowerCase().equals("last_read");
}
}
}
if (!error) { if (!error) {
AutoInputProperties autoInputProperties = new AutoInputProperties(name, activated, pooling, AutoInputProperties autoInputProperties = new AutoInputProperties(name, activated, pooling,
precision); precision, percentPrecision, lastRead);
result.add(autoInputProperties); result.add(autoInputProperties);
} }
} }
...@@ -62,12 +79,15 @@ public class AutoInputProperties { ...@@ -62,12 +79,15 @@ public class AutoInputProperties {
return result; return result;
} }
private AutoInputProperties(String inputAttributeName, boolean activated, double poolingPeriod, double precision) { private AutoInputProperties(String inputAttributeName, boolean activated, double poolingPeriod, double precision,
boolean percentPrecision, boolean lastRead) {
super(); super();
this.inputAttributeName = inputAttributeName; this.inputAttributeName = inputAttributeName;
this.activated = activated; this.activated = activated;
this.poolingPeriod = poolingPeriod; this.poolingPeriod = poolingPeriod;
this.precision = precision; this.precision = precision;
this.percentPrecision = percentPrecision;
this.lastRead = lastRead;
} }
public double getPoolingPeriod() { public double getPoolingPeriod() {
...@@ -85,4 +105,13 @@ public class AutoInputProperties { ...@@ -85,4 +105,13 @@ public class AutoInputProperties {
public boolean isActivated() { public boolean isActivated() {
return activated; return activated;
} }
public boolean isPercentPrecision() {
return percentPrecision;
}
public boolean isLastRead() {
return lastRead;
}
} }
...@@ -205,6 +205,8 @@ public final class TangoParser { ...@@ -205,6 +205,8 @@ public final class TangoParser {
private String status = ""; private String status = "";
private List<AJepParser> variablesJep = new ArrayList<AJepParser>(); private List<AJepParser> variablesJep = new ArrayList<AJepParser>();
private List<AutoInputAttributeManager> autoInputAttributeManagerList = null;
/** /**
* A single datasource manager per server. When scanMode==false, all cache is * A single datasource manager per server. When scanMode==false, all cache is
* managed per server * managed per server
...@@ -321,6 +323,11 @@ public final class TangoParser { ...@@ -321,6 +323,11 @@ public final class TangoParser {
stateResolver.stop(); stateResolver.stop();
} }
if(autoInputAttributeManagerList!=null) {
autoInputAttributeManagerList.forEach(autoInputAttrMgr ->autoInputAttrMgr.stop());
autoInputAttributeManagerList.clear();
autoInputAttributeManagerList = null;
}
xlogger.exit(); xlogger.exit();
} }
...@@ -517,6 +524,7 @@ public final class TangoParser { ...@@ -517,6 +524,7 @@ public final class TangoParser {
} }
} }
autoInputAttributeManagerList = new ArrayList<>(autoInputPropertiesList.size());
for (AutoInputProperties autoInputProperties : autoInputPropertiesList) { for (AutoInputProperties autoInputProperties : autoInputPropertiesList) {
DynamicAttributeParser dynAttrParser = dynAttributesMaps DynamicAttributeParser dynAttrParser = dynAttributesMaps
.get(autoInputProperties.getInputAttributeName().toLowerCase()); .get(autoInputProperties.getInputAttributeName().toLowerCase());
...@@ -530,6 +538,7 @@ public final class TangoParser { ...@@ -530,6 +538,7 @@ public final class TangoParser {
String attr_activator_name = autoInputProperties.getInputAttributeName() + autoInputActivatorTag; String attr_activator_name = autoInputProperties.getInputAttributeName() + autoInputActivatorTag;
AutoInputActivatorAttribute activatorAttribute = new AutoInputActivatorAttribute( AutoInputActivatorAttribute activatorAttribute = new AutoInputActivatorAttribute(
attr_activator_name, autoInputProperties.isActivated(), autoInputAttributeManager); attr_activator_name, autoInputProperties.isActivated(), autoInputAttributeManager);
autoInputAttributeManagerList.add(autoInputAttributeManager);
dynMngt.addAttribute(activatorAttribute); dynMngt.addAttribute(activatorAttribute);
} else { } else {
logger.error("The auto input configuration '" + autoInputProperties.getInputAttributeName() logger.error("The auto input configuration '" + autoInputProperties.getInputAttributeName()
......
...@@ -140,7 +140,8 @@ public class TangoParserTest { ...@@ -140,7 +140,8 @@ public class TangoParserTest {
private static final String wDoubleSQRTParser = "C"; private static final String wDoubleSQRTParser = "C";
//private static TangoSource mockSource = Mockito.mock(TangoSource.class, withSettings().verboseLogging()); // private static TangoSource mockSource = Mockito.mock(TangoSource.class,
// withSettings().verboseLogging());
private static TangoSource mockSource = Mockito.mock(TangoSource.class); private static TangoSource mockSource = Mockito.mock(TangoSource.class);
private static SourceManager mngr = Mockito.spy(SourceManager.class); private static SourceManager mngr = Mockito.spy(SourceManager.class);
...@@ -158,7 +159,8 @@ public class TangoParserTest { ...@@ -158,7 +159,8 @@ public class TangoParserTest {
@Override @Override
public Boolean answer(final InvocationOnMock invocation) { public Boolean answer(final InvocationOnMock invocation) {
System.out.println("mock add source " + invocation); System.out.println("mock add source " + invocation);
@SuppressWarnings("unchecked") final Map<String, String> arg = invocation.getArgumentAt(1, Map.class); @SuppressWarnings("unchecked")
final Map<String, String> arg = invocation.getArgumentAt(1, Map.class);
for (final String s : arg.keySet()) { for (final String s : arg.keySet()) {
if (s.contains("spec")) { if (s.contains("spec")) {
return true; return true;
...@@ -188,7 +190,8 @@ public class TangoParserTest { ...@@ -188,7 +190,8 @@ public class TangoParserTest {
// create device in tangodb // create device in tangodb
System.out.println("create device in tango db"); System.out.println("create device in tango db");
final Database db = ApiUtil.get_db_obj(); final Database db = ApiUtil.get_db_obj();
db.add_device(deviceNameParser, TangoParser.class.getSimpleName(), TangoParser.class.getSimpleName() + "/" + INSTANCE_NAME); db.add_device(deviceNameParser, TangoParser.class.getSimpleName(),
TangoParser.class.getSimpleName() + "/" + INSTANCE_NAME);
// configure properties // configure properties
final DbDatum[] dbDatum = new DbDatum[7]; final DbDatum[] dbDatum = new DbDatum[7];
...@@ -201,14 +204,11 @@ public class TangoParserTest { ...@@ -201,14 +204,11 @@ public class TangoParserTest {
"value1FloatSpec," + floatSpectrumPub, "value1ShortSpec," + shortSpectrumPub, "value1FloatSpec," + floatSpectrumPub, "value1ShortSpec," + shortSpectrumPub,
"value1IntSpec," + intSpectrumPub, }; "value1IntSpec," + intSpectrumPub, };
final String[] propOutputNames = new String[]{ final String[] propOutputNames = new String[] { doubleParser + ",value1Double>2",
doubleParser + ",value1Double>2",
"DevString " + stringParser + ",value1String+\"test\"", "DevString " + stringParser + ",value1String+\"test\"",
"DevBoolean " + booleanParser + ",!value1Boolean", "DevBoolean " + booleanParser + ",!value1Boolean", "DevShort " + shortParser + ",value1Short*2",
"DevShort " + shortParser + ",value1Short*2",
"DevBoolean " + shortParserBooleanExtract + ",boolextract(value1Short,3)", "DevBoolean " + shortParserBooleanExtract + ",boolextract(value1Short,3)",
"DevLong " + longParser + ",value1Long^5", "DevLong " + longParser + ",value1Long^5", "DevFloat " + floatParser + ",value1Float+2",
"DevFloat " + floatParser + ",value1Float+2",
"SPECTRUM DevString " + stringSpectrumParser + ",add(value1StringSpec,\"aa\")", "SPECTRUM DevString " + stringSpectrumParser + ",add(value1StringSpec,\"aa\")",
// "IMAGE DevDouble " + doubleImgParser + ",value1DoubleIm*2", // "IMAGE DevDouble " + doubleImgParser + ",value1DoubleIm*2",
...@@ -231,7 +231,8 @@ public class TangoParserTest { ...@@ -231,7 +231,8 @@ public class TangoParserTest {
"SPECTRUM DevShort " + shortSpectrumParserMul + ",mul(value1ShortSpec,value1ShortSpec)", "SPECTRUM DevShort " + shortSpectrumParserMul + ",mul(value1ShortSpec,value1ShortSpec)",
// Spectrum manipulation // Spectrum manipulation
"DevDouble " + doubleSpectrumParserElem + ",getSpectrumElem(value1DoubleSpec, value1Short)", "DevDouble " + doubleSpectrumParserElem + ",getSpectrumElem(value1DoubleSpec, value1Short)",
"SPECTRUM DevDouble " + doubleSpectrumParserSet + ",setSpectrumElem(value1DoubleSpec,value1Short,value1Double)", "SPECTRUM DevDouble " + doubleSpectrumParserSet
+ ",setSpectrumElem(value1DoubleSpec,value1Short,value1Double)",
"DevLong " + doubleSpectrumParserSize + ",getSpectrumSize(value1DoubleSpec)", "DevLong " + doubleSpectrumParserSize + ",getSpectrumSize(value1DoubleSpec)",
"SPECTRUM DevDouble " + doubleSpectrumParserRep + ",replicate(value1Double,value1Short)", "SPECTRUM DevDouble " + doubleSpectrumParserRep + ",replicate(value1Double,value1Short)",
// Soustraction // Soustraction
...@@ -272,22 +273,18 @@ public class TangoParserTest { ...@@ -272,22 +273,18 @@ public class TangoParserTest {
// Std // Std
"DevDouble " + doubleSpectrumParserStd + ",std(1,2,3,4,5,6,7,8,9,10)", "DevDouble " + doubleSpectrumParserStd + ",std(1,2,3,4,5,6,7,8,9,10)",
// Test Order // Test Order
orderParser + ",value1DoubleW/value2DoubleW", orderParser + ",value1DoubleW/value2DoubleW", orderComplexeParser
orderComplexeParser + ",(42*(value1DoubleW/(value1DoubleW*value2DoubleW))*(value1Short-value1Long+(value1Short/value1Long)))/(value1DoubleW/value2DoubleW*value1Short/value1Long)" };
+ ",(42*(value1DoubleW/(value1DoubleW*value2DoubleW))*(value1Short-value1Long+(value1Short/value1Long)))/(value1DoubleW/value2DoubleW*value1Short/value1Long)"
};
final String[] propInputNames = new String[]{"A,value1DoubleW=A+1", "SPECTRUM DevDouble B,value1DoubleWSpec=B*2", final String[] propInputNames = new String[] { "A,value1DoubleW=A+1",
"C,value1DoubleW=sqrt(C)", "D,value2DoubleW=(((D^2)/2)>2) || 0", "X,value1DoubleW=X+2", "SPECTRUM DevDouble B,value1DoubleWSpec=B*2", "C,value1DoubleW=sqrt(C)",
"X,value2DoubleW=X+2"}; "D,value2DoubleW=(((D^2)/2)>2) || 0", "X,value1DoubleW=X+2", "X,value2DoubleW=X+2" };
final String[] propIONames = new String[]{ final String[] propIONames = new String[] { "DevDouble IO;value1DoubleW+value1Short; value1DoubleW=IO+1",
"DevDouble IO;value1DoubleW+value1Short; value1DoubleW=IO+1",
ioParserComplex ioParserComplex
+ ";0.5*12398.42/lambda/(sin(0.5*atan(150.0/value1DoubleW)));lambda=12398.42/(value2DoubleW*1000.0);value1DoubleW=150.0/tan(2.0*asin(lambda/2.0/IOComplex))", + ";0.5*12398.42/lambda/(sin(0.5*atan(150.0/value1DoubleW)));lambda=12398.42/(value2DoubleW*1000.0);value1DoubleW=150.0/tan(2.0*asin(lambda/2.0/IOComplex))",
"SPECTRUM DevDouble IOSpectrum;[1, 2, 3, 4, 5, 6];value1DoubleWSpec=IOSpectrum/2", "SPECTRUM DevDouble IOSpectrum;[1, 2, 3, 4, 5, 6];value1DoubleWSpec=IOSpectrum/2",
"DevDouble IOSpectrumFactor;A;value1DoubleWSpec=[1, 2, 3, 4, 5, 6]*IOSpectrumFactor" "DevDouble IOSpectrumFactor;A;value1DoubleWSpec=[1, 2, 3, 4, 5, 6]*IOSpectrumFactor" };
};
dbDatum[0] = new DbDatum("AttributeNames", propAttributeNames); dbDatum[0] = new DbDatum("AttributeNames", propAttributeNames);
dbDatum[1] = new DbDatum("OutputNames", propOutputNames); dbDatum[1] = new DbDatum("OutputNames", propOutputNames);
...@@ -318,10 +315,9 @@ public class TangoParserTest { ...@@ -318,10 +315,9 @@ public class TangoParserTest {
try { try {
final TangoAttribute tangoParser = new TangoAttribute(deviceNameParser + "/state"); final TangoAttribute tangoParser = new TangoAttribute(deviceNameParser + "/state");
startState = (DevState) tangoParser.read(); startState = (DevState) tangoParser.read();
System.out.println("State readed !"); System.out.println("State readed : " + startState);
launched = true; launched = startState == DevState.ON;
} } catch (DevFailed e) {
catch (DevFailed e) {
launched = false; launched = false;
} }
timer -= stepTime; timer -= stepTime;
...@@ -350,7 +346,8 @@ public class TangoParserTest { ...@@ -350,7 +346,8 @@ public class TangoParserTest {
// System.err.println("device is not ON, status:\n" + status); // System.err.println("device is not ON, status:\n" + status);
// System.err.println("errors attribute value:\n" // System.err.println("errors attribute value:\n"
// + Arrays.toString(proxy.read_attribute("errors").extractStringArray())); // + Arrays.toString(proxy.read_attribute("errors").extractStringArray()));
// DevFailedUtils.throwDevFailed("INIT_ERROR", DeviceState.toString(state) + ":" + status); // DevFailedUtils.throwDevFailed("INIT_ERROR", DeviceState.toString(state) + ":"
// + status);
// } // }
} }
...@@ -969,8 +966,8 @@ public class TangoParserTest { ...@@ -969,8 +966,8 @@ public class TangoParserTest {
@Test @Test
public void testReadIntSpecAdd() throws DevFailed { public void testReadIntSpecAdd() throws DevFailed {
final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(intSpectrumPub), final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(intSpectrumPub), AttrDataFormat.SPECTRUM,
AttrDataFormat.SPECTRUM, intSpectrumParserAdd); intSpectrumParserAdd);
r.setValue(new Integer[] { 1, 2, 3, 4, 5 }); r.setValue(new Integer[] { 1, 2, 3, 4, 5 });
doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(intSpectrumPub)); doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(intSpectrumPub));
...@@ -1012,8 +1009,8 @@ public class TangoParserTest { ...@@ -1012,8 +1009,8 @@ public class TangoParserTest {
@Test @Test
public void testReadIntSpecCos() throws DevFailed { public void testReadIntSpecCos() throws DevFailed {
final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(intSpectrumPub), final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(intSpectrumPub), AttrDataFormat.SPECTRUM,
AttrDataFormat.SPECTRUM, intSpectrumParserCos); intSpectrumParserCos);
r.setValue(new Integer[] { 0, 1 }); r.setValue(new Integer[] { 0, 1 });
doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(intSpectrumPub)); doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(intSpectrumPub));
// final TangoAttribute pub = new TangoAttribute(intSpectrumPub); // final TangoAttribute pub = new TangoAttribute(intSpectrumPub);
...@@ -1027,8 +1024,8 @@ public class TangoParserTest { ...@@ -1027,8 +1024,8 @@ public class TangoParserTest {
@Test @Test
public void testReadIntSpecDiv() throws DevFailed { public void testReadIntSpecDiv() throws DevFailed {
final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(intSpectrumPub), final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(intSpectrumPub), AttrDataFormat.SPECTRUM,
AttrDataFormat.SPECTRUM, intSpectrumParserDiv); intSpectrumParserDiv);
r.setValue(new Integer[] { 2, 4, 6, 8, 10 }); r.setValue(new Integer[] { 2, 4, 6, 8, 10 });
doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(intSpectrumPub)); doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(intSpectrumPub));
// final TangoAttribute pub = new TangoAttribute(intSpectrumPub); // final TangoAttribute pub = new TangoAttribute(intSpectrumPub);
...@@ -1042,8 +1039,8 @@ public class TangoParserTest { ...@@ -1042,8 +1039,8 @@ public class TangoParserTest {
@Test @Test
public void testReadIntSpecFft() throws DevFailed { public void testReadIntSpecFft() throws DevFailed {
final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(intSpectrumPub), final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(intSpectrumPub), AttrDataFormat.SPECTRUM,
AttrDataFormat.SPECTRUM, intSpectrumParserFft); intSpectrumParserFft);
r.setValue(new Integer[] { 1, 2, 3, 4 }); r.setValue(new Integer[] { 1, 2, 3, 4 });
doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(intSpectrumPub)); doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(intSpectrumPub));
...@@ -1077,8 +1074,8 @@ public class TangoParserTest { ...@@ -1077,8 +1074,8 @@ public class TangoParserTest {
@Test @Test
public void testReadIntSpecLog() throws DevFailed { public void testReadIntSpecLog() throws DevFailed {
final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(intSpectrumPub), final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(intSpectrumPub), AttrDataFormat.SPECTRUM,
AttrDataFormat.SPECTRUM, intSpectrumParserLog); intSpectrumParserLog);
r.setValue(new Integer[] { 1, 2 }); r.setValue(new Integer[] { 1, 2 });
doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(intSpectrumPub)); doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(intSpectrumPub));
...@@ -1093,8 +1090,8 @@ public class TangoParserTest { ...@@ -1093,8 +1090,8 @@ public class TangoParserTest {
@Test @Test
public void testReadIntSpecMul() throws DevFailed { public void testReadIntSpecMul() throws DevFailed {
final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(intSpectrumPub), final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(intSpectrumPub), AttrDataFormat.SPECTRUM,
AttrDataFormat.SPECTRUM, intSpectrumParserMul); intSpectrumParserMul);
r.setValue(new Integer[] { 2, 4, 6, 8, 10 }); r.setValue(new Integer[] { 2, 4, 6, 8, 10 });
doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(intSpectrumPub)); doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(intSpectrumPub));
...@@ -1109,8 +1106,8 @@ public class TangoParserTest { ...@@ -1109,8 +1106,8 @@ public class TangoParserTest {
@Test @Test
public void testReadIntSpecSin() throws DevFailed { public void testReadIntSpecSin() throws DevFailed {
final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(intSpectrumPub), final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(intSpectrumPub), AttrDataFormat.SPECTRUM,
AttrDataFormat.SPECTRUM, intSpectrumParserSin); intSpectrumParserSin);
r.setValue(new Integer[] { 0, 1 }); r.setValue(new Integer[] { 0, 1 });
doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(intSpectrumPub)); doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(intSpectrumPub));
// final TangoAttribute pub = new TangoAttribute(intSpectrumPub); // final TangoAttribute pub = new TangoAttribute(intSpectrumPub);
...@@ -1124,8 +1121,8 @@ public class TangoParserTest { ...@@ -1124,8 +1121,8 @@ public class TangoParserTest {
@Test @Test
public void testReadIntSpecSub() throws DevFailed { public void testReadIntSpecSub() throws DevFailed {
final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(intSpectrumPub), final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(intSpectrumPub), AttrDataFormat.SPECTRUM,
AttrDataFormat.SPECTRUM, intSpectrumParserSub); intSpectrumParserSub);
r.setValue(new Integer[] { 2, 4, 6, 8, 10 }); r.setValue(new Integer[] { 2, 4, 6, 8, 10 });
doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(intSpectrumPub)); doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(intSpectrumPub));
// final TangoAttribute pub = new TangoAttribute(intSpectrumPub); // final TangoAttribute pub = new TangoAttribute(intSpectrumPub);
...@@ -1213,8 +1210,8 @@ public class TangoParserTest { ...@@ -1213,8 +1210,8 @@ public class TangoParserTest {
@Test @Test
public void testReadShortSpecAdd() throws DevFailed { public void testReadShortSpecAdd() throws DevFailed {
final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(shortSpectrumPub), final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(shortSpectrumPub), AttrDataFormat.SCALAR,
AttrDataFormat.SCALAR, shortSpectrumParserAdd); shortSpectrumParserAdd);
r.setValue(new Short[] { 1, 2, 3, 4, 5 }); r.setValue(new Short[] { 1, 2, 3, 4, 5 });
doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(shortSpectrumPub)); doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(shortSpectrumPub));
// final TangoAttribute pub = new TangoAttribute(shortSpectrumPub); // final TangoAttribute pub = new TangoAttribute(shortSpectrumPub);
...@@ -1228,8 +1225,8 @@ public class TangoParserTest { ...@@ -1228,8 +1225,8 @@ public class TangoParserTest {
@Test @Test
public void testReadShortSpecCos() throws DevFailed { public void testReadShortSpecCos() throws DevFailed {
final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(shortSpectrumPub), final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(shortSpectrumPub), AttrDataFormat.SCALAR,
AttrDataFormat.SCALAR, shortSpectrumParserCos); shortSpectrumParserCos);
r.setValue(new Short[] { 0, 1 }); r.setValue(new Short[] { 0, 1 });
doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(shortSpectrumPub)); doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(shortSpectrumPub));
// final TangoAttribute pub = new TangoAttribute(shortSpectrumPub); // final TangoAttribute pub = new TangoAttribute(shortSpectrumPub);
...@@ -1243,8 +1240,8 @@ public class TangoParserTest { ...@@ -1243,8 +1240,8 @@ public class TangoParserTest {
@Test @Test
public void testReadShortSpecDiv() throws DevFailed { public void testReadShortSpecDiv() throws DevFailed {
final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(shortSpectrumPub), final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(shortSpectrumPub), AttrDataFormat.SCALAR,
AttrDataFormat.SCALAR, shortSpectrumParserDiv); shortSpectrumParserDiv);
r.setValue(new Short[] { 2, 4, 6, 8, 10 }); r.setValue(new Short[] { 2, 4, 6, 8, 10 });
doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(shortSpectrumPub)); doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(shortSpectrumPub));
...@@ -1259,8 +1256,8 @@ public class TangoParserTest { ...@@ -1259,8 +1256,8 @@ public class TangoParserTest {
@Test @Test
public void testReadShortSpecFft() throws DevFailed { public void testReadShortSpecFft() throws DevFailed {
final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(shortSpectrumPub), final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(shortSpectrumPub), AttrDataFormat.SCALAR,
AttrDataFormat.SCALAR, shortSpectrumParserFft); shortSpectrumParserFft);
r.setValue(new Short[] { 1, 2 }); r.setValue(new Short[] { 1, 2 });
doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(shortSpectrumPub)); doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(shortSpectrumPub));
...@@ -1276,8 +1273,8 @@ public class TangoParserTest { ...@@ -1276,8 +1273,8 @@ public class TangoParserTest {
@Test @Test
public void testReadShortSpecLog() throws DevFailed { public void testReadShortSpecLog() throws DevFailed {
final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(shortSpectrumPub), final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(shortSpectrumPub), AttrDataFormat.SCALAR,
AttrDataFormat.SCALAR, shortSpectrumParserLog); shortSpectrumParserLog);
r.setValue(new Short[] { 1, 2 }); r.setValue(new Short[] { 1, 2 });
doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(shortSpectrumPub)); doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(shortSpectrumPub));
...@@ -1292,8 +1289,8 @@ public class TangoParserTest { ...@@ -1292,8 +1289,8 @@ public class TangoParserTest {
@Test @Test
public void testReadShortSpecMul() throws DevFailed { public void testReadShortSpecMul() throws DevFailed {
final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(shortSpectrumPub), final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(shortSpectrumPub), AttrDataFormat.SCALAR,
AttrDataFormat.SCALAR, shortSpectrumParserMul); shortSpectrumParserMul);
r.setValue(new Short[] { 2, 4, 6, 8, 10 }); r.setValue(new Short[] { 2, 4, 6, 8, 10 });
doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(shortSpectrumPub)); doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(shortSpectrumPub));
...@@ -1309,8 +1306,8 @@ public class TangoParserTest { ...@@ -1309,8 +1306,8 @@ public class TangoParserTest {
@Test @Test
public void testReadShortSpecSin() throws DevFailed { public void testReadShortSpecSin() throws DevFailed {
final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(shortSpectrumPub), final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(shortSpectrumPub), AttrDataFormat.SCALAR,
AttrDataFormat.SCALAR, shortSpectrumParserSin); shortSpectrumParserSin);
r.setValue(new Short[] { 0, 1 }); r.setValue(new Short[] { 0, 1 });
doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(shortSpectrumPub)); doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(shortSpectrumPub));
...@@ -1325,8 +1322,8 @@ public class TangoParserTest { ...@@ -1325,8 +1322,8 @@ public class TangoParserTest {
@Test @Test
public void testReadShortSpecSub() throws DevFailed { public void testReadShortSpecSub() throws DevFailed {
final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(shortSpectrumPub), final AttributeResult r = new AttributeResult(deviceNameParser, getAtt(shortSpectrumPub), AttrDataFormat.SCALAR,
AttrDataFormat.SCALAR, shortSpectrumParserSub); shortSpectrumParserSub);
r.setValue(new Short[] { 2, 3, 4, 5, 6 }); r.setValue(new Short[] { 2, 3, 4, 5, 6 });
doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(shortSpectrumPub)); doReturn(r).when(mockSource).getResult(deviceNameParser, getAtt(shortSpectrumPub));
...@@ -1446,8 +1443,8 @@ public class TangoParserTest { ...@@ -1446,8 +1443,8 @@ public class TangoParserTest {
} }
/** /**
* Test command setExpression for READ attribute. The name of the test start * Test command setExpression for READ attribute. The name of the test start by
* by z because we want execute it at the end to not affect other test. * z because we want execute it at the end to not affect other test.
* *
* @throws DevFailed * @throws DevFailed
*/ */
...@@ -1474,9 +1471,8 @@ public class TangoParserTest { ...@@ -1474,9 +1471,8 @@ public class TangoParserTest {
} }
/** /**
* Test command setExpression for WRITE attribute. The name of the test * Test command setExpression for WRITE attribute. The name of the test start by
* start by z because we want execute it at the end to not affect other * z because we want execute it at the end to not affect other test.
* test.
* *
* @throws DevFailed * @throws DevFailed
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment