use of com.axibase.tsd.api.model.command.EntityCommand in project atsd-api-test by axibase.
the class EntityCommandTest method testModels.
/**
* Model test
*/
@Test
public void testModels() throws Exception {
final Entity sourceEntity = new Entity(entity(), Mocks.TAGS);
sourceEntity.setInterpolationMode(InterpolationMode.PREVIOUS);
sourceEntity.setLabel(Mocks.LABEL);
sourceEntity.setTimeZoneID(Mocks.TIMEZONE_ID);
sourceEntity.setEnabled(true);
EntityCommand command = new EntityCommand(sourceEntity);
CommandMethod.send(command);
String assertMessage = String.format("Inserted entity doesn't exist.%nCommand: %s", command);
assertEntityExisting(assertMessage, sourceEntity);
}
use of com.axibase.tsd.api.model.command.EntityCommand in project atsd-api-test by axibase.
the class EntityCommandTest method testAddNewEntityTagsMailformedForNewEntity.
@Issue("3111")
@Test
public void testAddNewEntityTagsMailformedForNewEntity() throws Exception {
Entity entity = new Entity("ent-for-test-add-tags-mailformed");
entity.addTag("hello 1", "world");
PlainCommand command = new EntityCommand(entity);
CommandSendingResult expectedResult = new CommandSendingResult(1, 0);
assertEquals(expectedResult, CommandMethod.send(command));
}
use of com.axibase.tsd.api.model.command.EntityCommand in project atsd-api-test by axibase.
the class TCPSenderTest method testDebugSend.
@Test
public void testDebugSend() throws Exception {
Entity entity = new Entity(entity(), TAGS);
entity.setTimeZoneID(TIMEZONE_ID);
entity.setInterpolationMode(InterpolationMode.LINEAR);
entity.setLabel(LABEL);
String result = TCPSender.send(singletonList(new EntityCommand(entity)), true);
assertEquals("ok", result);
assertCheck(new EntityCheck(entity));
}
use of com.axibase.tsd.api.model.command.EntityCommand in project atsd-api-test by axibase.
the class EntityCommandTest method testUpdateEntityTagsForExistEntity.
@Issue("3111")
@Test
public void testUpdateEntityTagsForExistEntity() throws Exception {
Entity storedEntityUpdateTags = new Entity("e-for-test-update-tags");
storedEntityUpdateTags.addTag(E_TAG_1, E_VAL_1);
createOrReplaceEntityCheck(storedEntityUpdateTags);
storedEntityUpdateTags.setTags(Collections.singletonMap(E_TAG_1, E_VAL_1_UPD));
PlainCommand command = new EntityCommand(storedEntityUpdateTags);
CommandMethod.send(command);
assertEntityExisting("Entity tag isn't update for existing entity.", storedEntityUpdateTags);
}
use of com.axibase.tsd.api.model.command.EntityCommand in project atsd-api-test by axibase.
the class EntityCommandTest method testNullEnabled.
@Issue("3550")
@Test
public void testNullEnabled() throws Exception {
Entity entity = new Entity(entity());
entity.setEnabled(null);
EntityCommand command = new EntityCommand(entity);
CommandMethod.send(command);
Checker.check(new EntityCheck(entity));
Entity actualEntity = EntityMethod.getEntity(entity.getName());
assertTrue("Failed to omit enabled", actualEntity.getEnabled());
}
Aggregations