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

TU

parent 3aaa088a
Branches
No related tags found
No related merge requests found
......@@ -131,6 +131,12 @@
<version>1.4.200</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.8.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
......
......@@ -284,7 +284,7 @@ public abstract class GenericExtractorMethods {
.append(selectField1).append(") FROM ").append(connector.getSchema()).append(".")
.append(utils.getTableName(attributeName)).append(" WHERE (").append(selectField0)
.append(" BETWEEN ").append(utils.toDbTimeString(time0.trim())).append(" AND ")
.append(utils.toDbTimeString(time1.trim())).append(") ORDER BY time").toString();
.append(utils.toDbTimeString(time1.trim())).append(")").toString();
try {
conn = connector.getConnection();
if (conn == null) {
......
package fr.soleil.archiving.hdbtdb.api.management.attributes.adtapt;
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 java.sql.SQLException;
import java.util.Collection;
import org.junit.Test;
......@@ -61,4 +65,60 @@ public class AdtAptAttributesTest extends OracleConnectorTest {
}
@Test
public void getAttDefinitionDataTest() throws ArchivingException, SQLException {
OracleAdtAptAttributes adp = new OracleAdtAptAttributes(hdbConnector, new AttributeIds(hdbConnector));
Collection<String> result = adp.getAttDefinitionData(attributeTestFullName);
assertFalse(result.isEmpty());
assertArrayEquals(new String[] {
"ID::9",
"time::21-NOV-12 10.37.02.000000000 AM",
"full_name::liquibase/tangotest/member/string_spectrum_rw",
"device::tango/tangotest/7",
"domain::liquibase",
"family::tangotest",
"member::member",
"att_name::string_spectrum_rw",
"data_type::8",
"data_format::1",
"writable::3",
"max_dim_x::256",
"max_dim_y::0",
"levelg::0",
"facility::calypso:20001",
"archivable::0",
"substitute::0"
}, result.toArray());
}
@Test
public void isRegisteredADTTest() throws ArchivingException {
OracleAdtAptAttributes adp = new OracleAdtAptAttributes(hdbConnector, new AttributeIds(hdbConnector));
assertTrue(adp.isRegisteredADT(attributeTestFullName));
assertFalse(adp.isRegisteredADT(attributeTestFullName + "fake"));
}
@Test
public void getAttRecordCountTest() throws ArchivingException {
OracleAdtAptAttributes adp = new OracleAdtAptAttributes(hdbConnector, new AttributeIds(hdbConnector));
assertEquals(3, adp.getAttRecordCount(attributeTestFullName));
try {
assertEquals(0, adp.getAttRecordCount(attributeTestFullName + "fake"));
assertFalse("Shoudl not reach", true);
}catch (ArchivingException e) {
assertEquals("Id not found", e.getMessage());
}
}
@Test
public void getAttTFWDataByIdTest() throws ArchivingException {
OracleAdtAptAttributes adp = new OracleAdtAptAttributes(hdbConnector, new AttributeIds(hdbConnector));
int[] tfw = adp.getAttTFWDataById(1);
assertEquals(TangoConst.Tango_DEV_DOUBLE, tfw[0]);
assertEquals(AttrDataFormat._SCALAR, tfw[1]);
assertEquals(AttrWriteType._READ_WRITE, tfw[2]);
}
}
package fr.soleil.archiving.hdbtdb.api.management.attributes.extractor.datagetters.betweendates;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import fr.soleil.archiving.common.api.exception.ArchivingException;
import fr.soleil.archiving.hdbtdb.api.management.attributes.adtapt.OracleConnectorTest;
public class MinMawAvgGettersBetweenDatesTest extends OracleConnectorTest {
@Test
public void getAttDataMinBetweenDatesTest() throws ArchivingException {
MinMaxAvgGettersBetweenDates datagetter = new MinMaxAvgGettersBetweenDates(hdbConnector);
double result = datagetter.getAttDataMinBetweenDates(
new String[] { DEFAULT + "double_scalar_rw", "11-12-2012", "12-12-2012" });
assertEquals(-255.84408754008876, result, 0);
}
@Test
public void getAttDataMaxBetweenDatesTest() throws ArchivingException {
MinMaxAvgGettersBetweenDates datagetter = new MinMaxAvgGettersBetweenDates(hdbConnector);
double result = datagetter
.getAttDataMaxBetweenDates(new String[] { DEFAULT + "double_scalar_rw", "11-12-2012", "12-12-2012" });
assertEquals(235.908766, result, 0);
}
@Test
public void getAttDataAvgBetweenDatesTest() throws ArchivingException {
MinMaxAvgGettersBetweenDates datagetter = new MinMaxAvgGettersBetweenDates(hdbConnector);
double result = datagetter
.getAttDataAvgBetweenDates(new String[] { DEFAULT + "double_scalar_rw", "11-12-2012", "12-12-2012" });
assertEquals(60.59843685367324, result, 0);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment