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

Correction of the read and write parts for inputnames attributes. Reinforce...

Correction of the read and write parts for inputnames attributes. Reinforce some junit tests to cover the issue.
parent 12181cb4
Branches
Tags TangoParser-3.3.7
No related merge requests found
......@@ -12,7 +12,7 @@
<groupId>fr.soleil.deviceservers</groupId>
<artifactId>TangoParser</artifactId>
<version>3.3.6</version>
<version>3.3.7</version>
<name>TangoParser</name>
<description>TangoParser Device</description>
......
......@@ -238,6 +238,7 @@ public final class DynamicAttributeParser implements IWriteLockAttributeBehaviou
public void internalSetValue(final AttributeValue value) throws DevFailed {
logger.debug("writing {} on {}", config.getName(), value.getValue());
isWriteInitialized = true;
setWriteValue(value);
jepParserWriterGroup.setValue(value.getValue(), true);
}
......
......@@ -1395,9 +1395,9 @@ public class TangoParserTest {
// pub2.write(1.0);
final TangoAttribute tangoParser = new TangoAttribute(deviceNameParser + "/" + wDoublesParser);
tangoParser.write(1.0); // It's this write that important here
tangoParser.write(3.0); // It's this write that important here
final double expected = 3;
final double expected = 5;
verify(mockSource).write(eq(wDoublesParser), eq(expected), eq(expected));
// final Object result1 = pub1.read();
// final Object value1 = (double) 3D;
......@@ -1412,7 +1412,15 @@ public class TangoParserTest {
// As it's difficult to build another device in a unitary test, the test is
// valid if there's no exceptions raised.
final TangoAttribute tangoParser = new TangoAttribute(deviceNameParser + "/" + wDoubleParserSpec);
Double[] writeVal = new Double[]{1.0, 2.0, 3.0, 4.0, 5.0};
tangoParser.write(new Double[]{1.0, 2.0, 3.0, 4.0, 5.0});
//On inputNames attribute, write value and read values are equals.
Object readVal = tangoParser.read();
assertThat(readVal, equalTo(writeVal));
final Object[] expected = new Double[]{2.0, 4.0, 6.0, 8.0, 10.0};
verify(mockSource).write(eq(wDoubleParserSpec), eq(expected));
}
@Test
......@@ -1420,7 +1428,9 @@ public class TangoParserTest {
// As it's difficult to build another device in a unitary test, the test is
// valid if there's no exceptions raised.
final TangoAttribute tangoParser = new TangoAttribute(deviceNameParser + "/IOSpectrum");
tangoParser.write(new Double[]{1.0, 2.0, 3.0, 4.0, 5.0});
tangoParser.write(new Double[]{2.0, 4.0, 6.0, 8.0, 10.0});
final Object[] expected = new Double[]{1.0, 2.0, 3.0, 4.0, 5.0};
verify(mockSource).write(eq("IOSpectrum"), eq(expected));
}
@Test
......@@ -1429,6 +1439,8 @@ public class TangoParserTest {
// valid if there's no exceptions raised.
final TangoAttribute tangoParser = new TangoAttribute(deviceNameParser + "/IOSpectrumFactor");
tangoParser.write(3.0);
final Object[] expected = new Double[]{3.0, 6.0, 9.0, 12.0, 15.0, 18.0};
verify(mockSource).write(eq("IOSpectrumFactor"), eq(expected));
}
@Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment