Search in sources :

Example 1 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_set_duration.

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

Example 2 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_tmpdir.

@Test
public void error_should_anonymize_tmpdir() {
    // given
    ActionMessage message = builder.action("the smurfs");
    // when
    String junkyard = AnonymizeUtils.HOME_DIR;
    message.error("there's no " + junkyard + " in the smurf village");
    // then
    assertThat(message.getError()).doesNotContain(junkyard);
}
Also used : ActionMessage(com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage) Test(org.junit.jupiter.api.Test)

Example 3 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_IP_address.

@Test
public void error_should_anonymize_IP_address() {
    // given
    ActionMessage message = builder.action("the smurfs");
    // when
    String IP = "192.168.1.42";
    message.error("the smurf village must be kept secret, that's why their IP " + IP + " is anonymized");
    // then
    assertThat(message.getError()).doesNotContain(IP);
}
Also used : ActionMessage(com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage) Test(org.junit.jupiter.api.Test)

Example 4 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_set_result.

@Test
public void send_should_set_result() throws InterruptedException {
    // given
    ActionMessage message = builder.action("jolly jumper");
    // when
    TelemetryEvent event = message.send();
    // then
    assertThat(event.getProperties().get(PROP_RESULT)).isNotNull();
}
Also used : ActionMessage(com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage) Test(org.junit.jupiter.api.Test)

Example 5 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_send_to_same_facade_instance.

@Test
public void send_should_send_to_same_facade_instance() {
    // given
    ActionMessage message1 = builder.action("gargamel");
    ActionMessage message2 = builder.action("azrael");
    ActionMessage message3 = builder.action("papa smurf");
    // when
    message1.send();
    message2.send();
    message3.send();
    // then
    verify(serviceFacadeMock, times(3)).send(any(TelemetryEvent.class));
}
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