Search in sources :

Example 26 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_action_type.

@Test
public void action_should_create_message_with_action_type() {
    // given
    // when
    ActionMessage message = builder.action("azrael");
    // then
    assertThat(message.getType()).isEqualTo(ACTION);
}
Also used : ActionMessage(com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage) Test(org.junit.jupiter.api.Test)

Example 27 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_clear_error.

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

Example 28 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 finished_should_set_duration_btw_given_start_and_finished_when_stop_is_new_day.

@Test
public void finished_should_set_duration_btw_given_start_and_finished_when_stop_is_new_day() {
    // given
    ActionMessage message = builder.action("inspector gadget hits the button");
    LocalDateTime started = LocalDateTime.of(LocalDate.now(), LocalTime.of(23, 0));
    message.started(started);
    int hours = 2;
    LocalDateTime stopped = started.plusHours(hours);
    // when local time is crossing into new day
    message.finished(stopped);
    // then
    assertThat(TimeUtils.toDuration(message.getDuration())).isEqualTo(Duration.ofHours(hours));
}
Also used : LocalDateTime(java.time.LocalDateTime) ActionMessage(com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage) Test(org.junit.jupiter.api.Test)

Example 29 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_add_property_with_given_key_and_name.

@Test
public void property_should_add_property_with_given_key_and_name() {
    // given
    String key = "likes";
    String value = "papa smurf";
    // when
    ActionMessage message = builder.action("smurfette").property(key, value);
    // then
    assertThat(message.getProperty(key)).isEqualTo(value);
}
Also used : ActionMessage(com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage) Test(org.junit.jupiter.api.Test)

Example 30 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_anonymize_homedir.

@Test
public void error_should_anonymize_homedir() {
    // given
    ActionMessage message = builder.action("the smurfs");
    // when
    String homedir = AnonymizeUtils.HOME_DIR;
    message.error(homedir + " is their village");
    // then
    assertThat(message.getError()).doesNotContain(homedir);
}
Also used : ActionMessage(com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage) 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