use of com.axibase.tsd.api.model.extended.CommandSendingResult in project atsd-api-test by axibase.
the class LengthTest method testMaxLengthOverflow.
@Issue("2412")
@Test
public void testMaxLengthOverflow() throws Exception {
SeriesCommand seriesCommand = new SeriesCommand();
seriesCommand.setTimeISO(ISO_TIME);
seriesCommand.setEntityName(entity());
Integer currentLength = seriesCommand.compose().length();
Map<String, String> values = new HashMap<>();
while (currentLength <= MAX_LENGTH) {
Series series = new Series(seriesCommand.getEntityName(), metric());
series.addSamples(Sample.ofDateInteger(ISO_TIME, 1));
String appendix = FieldFormat.keyValue("m", series.getMetric(), "1");
currentLength += appendix.length();
values.put(series.getMetric(), "1");
}
seriesCommand.setValues(values);
assertTrue("SeriesCommand length is not overflow", seriesCommand.compose().length() > MAX_LENGTH);
CommandSendingResult expectedResult = new CommandSendingResult(1, 0);
assertEquals("Sending result must contain one failed command", expectedResult, CommandMethod.send(seriesCommand));
}
use of com.axibase.tsd.api.model.extended.CommandSendingResult in project atsd-api-test by axibase.
the class MetricCommandTest method testIncorrectInterpolation.
@Issue("3137")
@Test(dataProvider = "incorrectInterpolationFieldProvider")
public void testIncorrectInterpolation(String value) throws Exception {
String metricName = metric();
String incorrectCommand = String.format("metric m:%s i:%s", metricName, value);
CommandSendingResult expectedResult = new CommandSendingResult(1, 0);
String assertMessage = String.format("Metric with incorrect interpolate field (%s) shouldn't be inserted", value);
assertEquals(assertMessage, expectedResult, CommandMethod.send(incorrectCommand));
}
use of com.axibase.tsd.api.model.extended.CommandSendingResult in project atsd-api-test by axibase.
the class MetricCommandTest method testIncorrectTimeZone.
@Issue("3137")
@Test(dataProvider = "incorrectTimeZoneProvider")
public void testIncorrectTimeZone(String incorrectTimeZone) throws Exception {
String metricName = metric();
String incorrectCommand = String.format("metric m:%s z:%s", metricName, incorrectTimeZone);
CommandSendingResult expectedResult = new CommandSendingResult(1, 0);
String assertMessage = String.format("Metric with incorrect versioning field (%s) shouldn't be inserted", incorrectCommand);
assertEquals(assertMessage, expectedResult, CommandMethod.send(incorrectCommand));
}
use of com.axibase.tsd.api.model.extended.CommandSendingResult in project atsd-api-test by axibase.
the class MetricCommandTest method testRequired.
@Issue("3137")
@Test
public void testRequired() throws Exception {
MetricCommand command = new MetricCommand((String) null);
CommandSendingResult expectedResult = new CommandSendingResult(1, 0);
assertEquals("Command without metric Name sholdn't be inserted", expectedResult, CommandMethod.send(command));
}
Aggregations