Search in sources :

Example 6 with ActionMessage

use of com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage in project intellij-redhat-telemetry by redhat-developer.

the class TelemetryMessageBuilderTest method error_should_NOT_NPE_for_given_null_exception.

@Test
public void error_should_NOT_NPE_for_given_null_exception() {
    // given
    ActionMessage message = builder.action("the simpsons");
    // when
    message.error((Exception) null);
    // then
    assertThat(message.getError()).isNull();
}
Also used : ActionMessage(com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage) Test(org.junit.jupiter.api.Test)

Example 7 with ActionMessage

use of com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage in project intellij-redhat-telemetry by redhat-developer.

the class TelemetryMessageBuilderTest method action_should_create_message_with_given_name.

@Test
public void action_should_create_message_with_given_name() {
    // given
    String name = "papa smurf";
    // when
    ActionMessage message = builder.action(name);
    // then
    assertThat(message.getName()).isEqualTo(name);
}
Also used : ActionMessage(com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage) Test(org.junit.jupiter.api.Test)

Example 8 with ActionMessage

use of com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage in project intellij-redhat-telemetry by redhat-developer.

the class TelemetryMessageBuilderTest method property_should_ignore_property_with_null_key.

@Test
public void property_should_ignore_property_with_null_key() {
    // given
    ActionMessage message = builder.action("smurfette");
    int beforeAdding = message.properties().size();
    // when
    message.property(null, "papa smurf");
    // then
    assertThat(message.properties().size()).isEqualTo(beforeAdding);
}
Also used : ActionMessage(com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage) Test(org.junit.jupiter.api.Test)

Example 9 with ActionMessage

use of com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage in project intellij-redhat-telemetry by redhat-developer.

the class TelemetryMessageBuilderTest method result_should_set_result_property.

@Test
public void result_should_set_result_property() {
    // given
    ActionMessage message = builder.action("flinstones");
    String result = "crushed stones";
    // when
    message.result(result);
    // then
    assertThat(message.getResult()).isEqualTo(result);
}
Also used : ActionMessage(com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage) Test(org.junit.jupiter.api.Test)

Example 10 with ActionMessage

use of com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage in project intellij-redhat-telemetry by redhat-developer.

the class TelemetryMessageBuilderTest method send_should_NOT_set_duration_if_already_exists.

@Test
public void send_should_NOT_set_duration_if_already_exists() throws InterruptedException {
    // given
    ActionMessage message = builder.action("jolly jumper");
    Duration existing = Duration.ofDays(7);
    message.duration(existing);
    // when
    TelemetryEvent event = message.send();
    // then dont override existing duration
    assertThat(TimeUtils.toDuration(event.getProperties().get(PROP_DURATION))).isEqualTo(existing);
}
Also used : ActionMessage(com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage) Duration(java.time.Duration) Test(org.junit.jupiter.api.Test)

Aggregations

ActionMessage (com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage)39 Test (org.junit.jupiter.api.Test)26 IOException (java.io.IOException)11 ParentableNode (com.redhat.devtools.intellij.tektoncd.tree.ParentableNode)6 Notification (com.intellij.notification.Notification)3 PipelineRunNode (com.redhat.devtools.intellij.tektoncd.tree.PipelineRunNode)3 TaskRunNode (com.redhat.devtools.intellij.tektoncd.tree.TaskRunNode)3 Tkn (com.redhat.devtools.intellij.tektoncd.tkn.Tkn)2 PipelineNode (com.redhat.devtools.intellij.tektoncd.tree.PipelineNode)2 TektonTreeStructure (com.redhat.devtools.intellij.tektoncd.tree.TektonTreeStructure)2 Duration (java.time.Duration)2 LocalDateTime (java.time.LocalDateTime)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 YAMLMapper (com.fasterxml.jackson.dataformat.yaml.YAMLMapper)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 Project (com.intellij.openapi.project.Project)1 Messages (com.intellij.openapi.ui.Messages)1 GenericResource (com.redhat.devtools.intellij.common.model.GenericResource)1 ExecHelper (com.redhat.devtools.intellij.common.utils.ExecHelper)1 UIHelper (com.redhat.devtools.intellij.common.utils.UIHelper)1