use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class SeriesSearchTest method testFieldsTags.
@Issue("4404")
@Test(description = "Test explicitly requested fields and tags are returned")
public void testFieldsTags() {
SeriesSearchQuery query = new SeriesSearchQuery("sst_1*");
query.addEntityFields("interpolate", "timezone");
query.addEntityTags("sst_11_entity_tag");
query.addMetricFields("datatype", "timeprecision");
query.addMetricTags("sst_11_metric_tag");
Entity entity1 = new Entity().setName(resultRecord1.getEntity().getName()).setLabel(resultRecord1.getEntity().getLabel()).setInterpolationMode(resultRecord1.getEntity().getInterpolationMode()).setTimeZoneID(resultRecord1.getEntity().getTimeZoneID());
Metric metirc1 = new Metric().setName(resultRecord1.getMetric().getName()).setLabel(resultRecord1.getMetric().getLabel()).setDataType(resultRecord1.getMetric().getDataType()).setTimePrecision(resultRecord1.getMetric().getTimePrecision());
SeriesSearchResultRecord expectedResult1 = new SeriesSearchResultRecord(entity1, metirc1, resultRecord1.getSeriesTags(), 1.0);
Entity entity2 = new Entity().setName(resultRecord3.getEntity().getName()).setLabel(resultRecord3.getEntity().getLabel()).setInterpolationMode(resultRecord3.getEntity().getInterpolationMode()).setTimeZoneID(resultRecord3.getEntity().getTimeZoneID()).setTags(resultRecord3.getEntity().getTags());
Metric metirc2 = new Metric().setName(resultRecord3.getMetric().getName()).setLabel(resultRecord3.getMetric().getLabel()).setDataType(resultRecord3.getMetric().getDataType()).setTimePrecision(resultRecord3.getMetric().getTimePrecision()).setTags(resultRecord3.getMetric().getTags());
SeriesSearchResultRecord expectedResult3 = new SeriesSearchResultRecord(entity2, metirc2, resultRecord3.getSeriesTags(), 1.0);
SeriesSearchResultRecord[] expectedResult = { expectedResult1, expectedResult3 };
checkQueryWithoutRelevance(query, Sets.newHashSet(Arrays.asList(expectedResult)));
}
use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class PropertyDeleteTest method testEntityTagsExactFalse.
@Test
public void testEntityTagsExactFalse() throws Exception {
final String entityTagsType = "$entity_tags";
final Entity entity = new Entity("delete-entity11");
entity.addTag("t1", "v1");
entity.addTag("t2", "v2");
final Property property = new Property();
property.setType(entityTagsType);
property.setEntity(entity.getName());
property.setTags(entity.getTags());
EntityMethod.createOrReplaceEntityCheck(entity);
assertTrue(propertyExist(property));
PropertyQuery deleteQuery = new PropertyQuery();
deleteQuery.setType("$entity_tags");
deleteQuery.setEntity(entity.getName());
deleteQuery.setExactMatch(false);
assertEquals("Fail to execute delete query", OK.getStatusCode(), deleteProperty(deleteQuery).getStatus());
assertTrue(propertyExist(property));
}
use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class SqlSelectEntityFieldsTest method prepareData.
@BeforeClass
public static void prepareData() throws Exception {
Entity entity = new Entity(TEST_ENTITY, Mocks.TAGS);
entity.setLabel(Mocks.LABEL);
entity.setEnabled(true);
entity.setInterpolationMode(InterpolationMode.PREVIOUS);
entity.setTimeZoneID(Mocks.TIMEZONE_ID);
Series series = new Series(TEST_ENTITY, TEST_METRIC);
series.addSamples(Mocks.SAMPLE);
EntityMethod.createOrReplaceEntityCheck(entity);
SeriesMethod.insertSeriesCheck(series);
}
use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class SqlStandardCollectionViewTest method prepareData.
@BeforeClass
public static void prepareData() throws Exception {
// Series data
List<Series> seriesList = new ArrayList<>();
seriesList.add(new Series(TEST_ENTITY1_NAME, TEST_METRIC1_NAME, TAGS) {
{
addSamples(Sample.ofDateInteger("2016-06-29T08:00:00.000Z", 0));
}
});
seriesList.add(new Series(TEST_ENTITY2_NAME, TEST_METRIC2_NAME) {
{
addSamples(Sample.ofDateInteger("2016-06-29T08:00:00.000Z", 1));
}
});
// Entity data
EntityMethod.createOrReplaceEntity(new Entity(TEST_ENTITY1_NAME, TAGS));
// Metric data
MetricMethod.createOrReplaceMetric(new Metric(TEST_METRIC1_NAME, TAGS));
SeriesMethod.insertSeriesCheck(seriesList);
// Entity groups data
EntityGroupMethod.createOrReplaceEntityGroup(new EntityGroup(TEST_ENTITY_GROUP1_NAME));
EntityGroupMethod.createOrReplaceEntityGroup(new EntityGroup(TEST_ENTITY_GROUP2_NAME));
EntityGroupMethod.addEntities(TEST_ENTITY_GROUP1_NAME, Collections.singletonList(TEST_ENTITY1_NAME));
EntityGroupMethod.addEntities(TEST_ENTITY_GROUP2_NAME, Collections.singletonList(TEST_ENTITY1_NAME));
}
use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class EntityCreateOrReplaceTest method testEntityNameContainsCyrillic.
@Issue("1278")
@Test
public void testEntityNameContainsCyrillic() throws Exception {
Entity entity = new Entity("createйёentity3");
assertEquals("Fail to execute createOrReplaceEntity query", OK.getStatusCode(), createOrReplaceEntity(entity).getStatus());
assertTrue("Fail to get required entity", entityExist(entity));
}
Aggregations