Skip to content
Snippets Groups Projects
Commit 99bd8225 authored by Arnaud Jelmoni's avatar Arnaud Jelmoni
Browse files

TU

parent ef39d06a
No related branches found
No related tags found
No related merge requests found
package fr.soleil.archiving.hdbtdb.api.management.attributes.extractor.datagetters.betweendates;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import fr.esrf.TangoDs.TimedAttrData;
import fr.soleil.archiving.common.api.exception.ArchivingException;
import fr.soleil.archiving.common.api.tools.DbData;
import fr.soleil.archiving.hdbtdb.api.management.attributes.adtapt.OracleConnectorTest;
public class InfSupGettersBetweenDatesTest extends OracleConnectorTest {
@Test
public void getAttDataInfThanBetweenDatesTest() throws ArchivingException {
InfSupGettersBetweenDates datagetter = new InfSupGettersBetweenDates(hdbConnector);
DbData result = datagetter.getAttDataInfThanBetweenDates(
new String[] { DEFAULT + "double_scalar_rw", "0", "11-12-2012", "12-12-2012" });
TimedAttrData[] timedData = result.getDataAsTimedAttrData();
assertEquals(1, timedData.length);
assertEquals(-255.84408754008876, timedData[0].db_ptr[0], 0);
}
@Test
public void getAttDataInfThanBetweenDatesCountTest() throws ArchivingException {
InfSupGettersBetweenDates datagetter = new InfSupGettersBetweenDates(hdbConnector);
int result = datagetter.getAttDataInfThanBetweenDatesCount(
new String[] { DEFAULT + "double_scalar_rw", "0", "11-12-2012", "12-12-2012" });
assertEquals(1, result);
}
@Test
public void getAttDataSupThanBetweenDatesTest() throws ArchivingException {
InfSupGettersBetweenDates datagetter = new InfSupGettersBetweenDates(hdbConnector);
DbData result = datagetter.getAttDataSupThanBetweenDates(
new String[] { DEFAULT + "double_scalar_rw", "0", "11-12-2012", "12-12-2012" });
TimedAttrData[] timedData = result.getDataAsTimedAttrData();
assertEquals(2, timedData.length);
assertEquals(235.908766, timedData[0].db_ptr[0], 0);
}
@Test
public void getAttDataSupThanBetweenDatesCount() throws ArchivingException {
InfSupGettersBetweenDates datagetter = new InfSupGettersBetweenDates(hdbConnector);
int result = datagetter.getAttDataSupThanBetweenDatesCount(
new String[] { DEFAULT + "double_scalar_rw", "0", "11-12-2012", "12-12-2012" });
assertEquals(2, result);
}
@Test
public void getAttDataInfOrSupThanBetweenDatesTest() throws ArchivingException {
InfSupGettersBetweenDates datagetter = new InfSupGettersBetweenDates(hdbConnector);
DbData result = datagetter.getAttDataInfOrSupThanBetweenDates(
new String[] { DEFAULT + "double_scalar_rw", "0", "202", "11-12-2012", "12-12-2012" });
TimedAttrData[] timedData = result.getDataAsTimedAttrData();
assertEquals(2, timedData.length);
assertEquals(-255.84408754008876, timedData[0].db_ptr[0], 0);
}
@Test
public void getAttDataInfOrSupThanBetweenDatesCount() throws ArchivingException {
InfSupGettersBetweenDates datagetter = new InfSupGettersBetweenDates(hdbConnector);
int result = datagetter.getAttDataInfOrSupThanBetweenDatesCount(
new String[] { DEFAULT + "double_scalar_rw", "0", "202", "11-12-2012", "12-12-2012" });
assertEquals(2, result);
}
@Test
public void getAttDataSupAndInfThanBetweenDatesTest() throws ArchivingException {
InfSupGettersBetweenDates datagetter = new InfSupGettersBetweenDates(hdbConnector);
DbData result = datagetter.getAttDataSupAndInfThanBetweenDates(
new String[] { DEFAULT + "double_scalar_rw", "0", "202", "11-12-2012", "12-12-2012" });
TimedAttrData[] timedData = result.getDataAsTimedAttrData();
assertEquals(2, timedData.length);
assertEquals(201.73063210110848, timedData[0].db_ptr[0], 0);
}
@Test
public void getAttDataSupAndInfThanBetweenDatesCount() throws ArchivingException {
InfSupGettersBetweenDates datagetter = new InfSupGettersBetweenDates(hdbConnector);
int result = datagetter.getAttDataSupAndInfThanBetweenDatesCount(
new String[] { DEFAULT + "double_scalar_rw", "0", "202", "11-12-2012", "12-12-2012" });
assertEquals(1, result);
}
}
package fr.soleil.archiving.hdbtdb.api.management.modes;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import fr.soleil.archiving.common.api.exception.ArchivingException;
import fr.soleil.archiving.hdbtdb.api.management.attributes.adtapt.OracleConnectorTest;
public class HdbModeTest extends OracleConnectorTest {
@Test
public void getCurrentArchivedAttTest() throws ArchivingException {
HdbMode mode = new HdbMode(hdbConnector);
assertArrayEquals(new String[] { DEFAULT + "double_scalar_rw" }, mode.getCurrentArchivedAtt());
}
@Test
public void getAttributeTest() throws ArchivingException {
HdbMode mode = new HdbMode(hdbConnector);
assertEquals(10, mode.getAttribute(false).length);
}
@Test
public void getCurrentArchivedAttCountTest() throws ArchivingException {
HdbMode mode = new HdbMode(hdbConnector);
assertEquals(1, mode.getCurrentArchivedAttCount());
}
@Test
public void getDeviceInChargeTest() throws ArchivingException {
HdbMode mode = new HdbMode(hdbConnector);
assertEquals("archiving/hdb-oracle/hdbarchiver.01", mode.getDeviceInCharge(DEFAULT + "double_scalar_rw"));
assertEquals("", mode.getDeviceInCharge(DEFAULT + "double_scalar_ro"));
}
@Test
public void isArchivedTest() throws ArchivingException {
HdbMode mode = new HdbMode(hdbConnector);
assertTrue(mode.isArchived(DEFAULT + "double_scalar_rw"));
assertFalse(mode.isArchived(DEFAULT + "double_scalar_rw", "archiving/hdb-oracle/hdbarchiverfake"));
assertFalse(mode.isArchived(DEFAULT + "double_scalar_ro"));
}
@Test
public void getArchiverForAttributeTest() throws ArchivingException {
HdbMode mode = new HdbMode(hdbConnector);
assertEquals("archiving/hdb-oracle/hdbarchiver.01", mode.getArchiverForAttribute(DEFAULT + "double_scalar_rw"));
assertEquals("", mode.getArchiverForAttribute(DEFAULT + "double_scalar_ro"));
}
}
ID;ARCHIVER;START_DATE;STOP_DATE;PER_MOD;PER_PER_MOD;ABS_MOD;PER_ABS_MOD;DEC_DEL_ABS_MOD;GRO_DEL_ABS_MOD;REL_MOD;PER_REL_MOD;N_PERCENT_REL_MOD;P_PERCENT_REL_MOD;THR_MOD;PER_THR_MOD;MIN_VAL_THR_MOD;MAX_VAL_THR_MOD;CAL_MOD;PER_CAL_MOD;VAL_CAL_MOD;TYPE_CAL_MOD;ALGO_CAL_MOD;DIF_MOD;PER_DIF_MOD;EXT_MOD
1;archiving/hdb-oracle/hdbarchiver.01;2012-12-11 15:38:06.667;2013-01-23 10:54:33.972;1;60;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;;1;10;0
\ No newline at end of file
1;archiving/hdb-oracle/hdbarchiver.01;2012-12-11 15:38:06.667;NULL;1;60;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;;1;10;0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment