Tabnine Logo
Tags.rootTag
Code IndexAdd Tabnine to your IDE (free)

How to use
rootTag
method
in
rocks.inspectit.server.diagnosis.engine.tag.Tags

Best Java code snippets using rocks.inspectit.server.diagnosis.engine.tag.Tags.rootTag (Showing top 20 results out of 315)

origin: inspectIT/inspectIT

/**
 * Creates the faked output of an internal rule to start process of other rules. If we wrap the
 * input to be analyzed into a RuleOutput the entire rule processing works exactly the same way
 * and and the input can be access of type {@link Tags#ROOT_TAG}.
 *
 * @param input
 *            The input to be wrapped in output.
 * @return RuleOutput providing the input as value of {@link Tags#ROOT_TAG}.
 */
public static RuleOutput triggerRuleOutput(Object input) {
  return new RuleOutput(TRIGGER_RULE, Tags.ROOT_TAG, Collections.<ConditionFailure> emptyList(), Collections.singleton(Tags.rootTag(input)));
}
origin: inspectIT/inspectIT

@Test
public void validRootTagInput() {
  rocks.inspectit.server.diagnosis.engine.tag.Tag tag = rocks.inspectit.server.diagnosis.engine.tag.Tags.rootTag("TestInput");
  assertThat(tag.getType(), equalTo(rocks.inspectit.server.diagnosis.engine.tag.Tags.ROOT_TAG));
  assertThat(tag.getValue().toString(), equalTo("TestInput"));
  assertThat(tag.getParent(), equalTo(null));
  assertThat(tag.getState(), equalTo(TagState.LEAF));
}
origin: inspectIT/inspectIT

  @Test
  public void nullRootTagInput() {
    rocks.inspectit.server.diagnosis.engine.tag.Tag tag = rocks.inspectit.server.diagnosis.engine.tag.Tags.rootTag(null);
    assertThat(tag.getType(), equalTo(rocks.inspectit.server.diagnosis.engine.tag.Tags.ROOT_TAG));
    assertThat(tag.getValue(), equalTo(null));
    assertThat(tag.getParent(), equalTo(null));
    assertThat(tag.getState(), equalTo(TagState.LEAF));
  }
}
origin: inspectIT/inspectIT

@Test
public void singleTagTypeSingleInput() throws RuleDefinitionException, SessionException {
  RuleDefinition ruleB = Rules.define(RuleB.class);
  Tag rootTag = Tags.rootTag("input");
  Tag tagA = Tags.tag("A", "input", rootTag);
  RuleOutput outputA = new RuleOutput("RuleA", "A", Collections.<ConditionFailure> emptyList(), Collections.singletonList(tagA));
  when(outputStorage.findLatestResultsByTagType(Matchers.<Set<String>> anyObject())).thenReturn(Collections.singleton(outputA));
  List<RuleInput> ruleInputs = new ArrayList<>(session.collectInputs(ruleB, outputStorage));
  assertThat(ruleInputs, hasSize(1));
  assertThat(ruleInputs.get(0).getRoot(), equalTo(tagA));
}
origin: inspectIT/inspectIT

  @Test
  public void noMatch2() throws RuleDefinitionException, SessionException {
    RuleDefinition ruleC = Rules.define(RuleC.class);
    Tag rootTag = Tags.rootTag("input");
    Tag tagA1 = Tags.tag("A", "A1", rootTag);
    Tag tagB1 = Tags.tag("B", "B1", rootTag);
    RuleOutput outputB1 = new RuleOutput("RuleA", "A", Collections.<ConditionFailure> emptyList(), Arrays.asList(tagB1));
    when(outputStorage.findLatestResultsByTagType(Matchers.<Set<String>> anyObject())).thenReturn(Arrays.asList(outputB1));
    Collection<RuleInput> ruleInputs = session.collectInputs(ruleC, outputStorage);
    assertThat(ruleInputs, empty());
  }
}
origin: inspectIT/inspectIT

@Test
public void multipleTagTypesSingleInput() throws RuleDefinitionException, SessionException {
  RuleDefinition ruleC = Rules.define(RuleC.class);
  Tag rootTag = Tags.rootTag("input");
  Tag tagA = Tags.tag("A", "A1", rootTag);
  Tag tagB = Tags.tag("B", "B1", tagA);
  RuleOutput outputB = new RuleOutput("RuleB", "B", Collections.<ConditionFailure> emptyList(), Collections.singletonList(tagB));
  when(outputStorage.findLatestResultsByTagType(Matchers.<Set<String>> anyObject())).thenReturn(Collections.singleton(outputB));
  List<RuleInput> ruleInputs = new ArrayList<>(session.collectInputs(ruleC, outputStorage));
  assertThat(ruleInputs, hasSize(1));
  assertThat(ruleInputs.get(0).getRoot(), equalTo(tagB));
  assertThat(ruleInputs.get(0).getUnraveled(), containsInAnyOrder(tagB, tagA));
}
origin: inspectIT/inspectIT

@Test
public void shouldProduceSingleTagWithSingleObjectValue() throws Exception {
  // prepare Mocks
  Tag rootTag = Tags.rootTag("Input");
  Tag expectedResultTag = new Tag("T1", "oneResult", rootTag);
  when(dummy.action()).thenReturn("oneResult");
  when(input.getRoot()).thenReturn(rootTag);
  // Create TestMethod
  ActionMethod action = new ActionMethod(RuleDummy.actionMethod(), "T1", Action.Quantity.SINGLE);
  // execute
  Collection<Tag> result = action.execute(context);
  // verify
  assertThat(result, hasSize(1));
  assertThat(result, hasItem(expectedResultTag));
}
origin: inspectIT/inspectIT

  @Test(expectedExceptions = RuleDefinitionException.class)
  public void shouldFailDueToQuantityAndResultMismatch() throws RuleDefinitionException, RuleExecutionException {
    Tag rootTag = Tags.rootTag("Input");
    when(dummy.action()).thenReturn("Fail");
    when(this.input.getRoot()).thenReturn(rootTag);
    // Execute and fail. ActionMethod would expect array/collection as result from ruleImpl
    // implementation.
    // But receives "Fail" String
    new ActionMethod(RuleDummy.actionMethod(), "T2", Action.Quantity.MULTIPLE).execute(context);
  }
}
origin: inspectIT/inspectIT

@Test
public void shouldProduceMultipleTagsFromCollection() throws Exception {
  // prepare Mocks
  Tag rootTag = Tags.rootTag("Input");
  when(dummy.action2()).thenReturn(new String[] { "one", "two", "three" });
  when(this.input.getRoot()).thenReturn(rootTag);
  // Create TestMethod
  ActionMethod action = new ActionMethod(RuleDummy.action2Method(), "T2", Action.Quantity.MULTIPLE);
  // execute
  Collection<Tag> result = action.execute(context);
  // verify
  Collection<Tag> tags = Tags.tags("T2", rootTag, "one", "two", "three");
  assertThat(result, containsInAnyOrder(tags.toArray()));
}
origin: inspectIT/inspectIT

@Test
public void shouldProduceSingleTagWithArrayValue() throws Exception {
  // prepare Mocks
  Tag rootTag = Tags.rootTag("Input");
  Tag expectedResultTag = new Tag("T1", new String[] { "one", "two", "three" }, rootTag);
  when(dummy.action()).thenReturn(new String[] { "one", "two", "three" });
  when(this.input.getRoot()).thenReturn(rootTag);
  // Create TestMethod
  ActionMethod action = new ActionMethod(RuleDummy.actionMethod(), "T1", Action.Quantity.SINGLE);
  // execute
  Collection<Tag> result = action.execute(context);
  // verify
  assertThat(result, hasSize(1));
  assertThat(result, containsInAnyOrder(expectedResultTag));
}
origin: inspectIT/inspectIT

@Test
public void shouldProduceMultipleTagsFromSingleArray() throws Exception {
  Tag rootTag = Tags.rootTag("Input");
  // prepare Mocks
  when(dummy.action2()).thenReturn(new String[] { "one", "two", "three" });
  when(this.input.getRoot()).thenReturn(rootTag);
  // Create TestMethod
  ActionMethod action = new ActionMethod(RuleDummy.action2Method(), "T2", Action.Quantity.MULTIPLE);
  // execute
  Collection<Tag> result = action.execute(context);
  // verify
  Collection<Tag> tags = Tags.tags("T2", rootTag, "one", "two", "three");
  assertThat(result, containsInAnyOrder(tags.toArray()));
}
origin: inspectIT/inspectIT

@Test
public void singleTagTypeMultipleInputs() throws RuleDefinitionException, SessionException {
  RuleDefinition ruleB = Rules.define(RuleB.class);
  Tag rootTag = Tags.rootTag("input");
  Tag tagA1 = Tags.tag("A", "A1", rootTag);
  Tag tagA2 = Tags.tag("A", "A2", rootTag);
  Tag tagA3 = Tags.tag("A", "A3", rootTag);
  RuleOutput outputA = new RuleOutput("RuleA", "A", Collections.<ConditionFailure> emptyList(), Arrays.asList(tagA1, tagA2, tagA3));
  when(outputStorage.findLatestResultsByTagType(Matchers.<Set<String>> anyObject())).thenReturn(Collections.singleton(outputA));
  Collection<RuleInput> ruleInputs = session.collectInputs(ruleB, outputStorage);
  assertThat(ruleInputs, hasSize(3));
  assertThat(ruleInputs, containsInAnyOrder(new RuleInput(tagA1, Sets.newHashSet(tagA1)), new RuleInput(tagA2, Sets.newHashSet(tagA2)), new RuleInput(tagA3, Sets.newHashSet(tagA3))));
}
origin: inspectIT/inspectIT

@Test
public void multipleTagTypesMultipleInputs1() throws RuleDefinitionException, SessionException {
  RuleDefinition ruleC = Rules.define(RuleC.class);
  Tag rootTag = Tags.rootTag("input");
  Tag tagA = Tags.tag("A", "A1", rootTag);
  Tag tagB1 = Tags.tag("B", "B1", tagA);
  Tag tagB2 = Tags.tag("B", "B2", tagA);
  RuleOutput outputB = new RuleOutput("RuleB", "B", Collections.<ConditionFailure> emptyList(), Arrays.asList(tagB1, tagB2));
  when(outputStorage.findLatestResultsByTagType(Matchers.<Set<String>> anyObject())).thenReturn(Collections.singleton(outputB));
  Collection<RuleInput> ruleInputs = session.collectInputs(ruleC, outputStorage);
  assertThat(ruleInputs, hasSize(2));
  assertThat(ruleInputs, containsInAnyOrder(new RuleInput(tagB1, Sets.newHashSet(tagA, tagB1)), new RuleInput(tagB2, Sets.newHashSet(tagA, tagB2))));
}
origin: inspectIT/inspectIT

@Test
public void multipleTagTypesMultipleInputs2() throws RuleDefinitionException, SessionException {
  RuleDefinition ruleC = Rules.define(RuleC.class);
  Tag rootTag = Tags.rootTag("input");
  Tag tagA1 = Tags.tag("A", "A1", rootTag);
  Tag tagB1 = Tags.tag("B", "B1", tagA1);
  Tag tagA2 = Tags.tag("A", "A2", rootTag);
  Tag tagB2 = Tags.tag("B", "B2", tagA2);
  RuleOutput outputB1 = new RuleOutput("RuleB", "B", Collections.<ConditionFailure> emptyList(), Arrays.asList(tagB1));
  RuleOutput outputB2 = new RuleOutput("RuleB", "B", Collections.<ConditionFailure> emptyList(), Arrays.asList(tagB2));
  when(outputStorage.findLatestResultsByTagType(Matchers.<Set<String>> anyObject())).thenReturn(Arrays.asList(outputB1, outputB2));
  Collection<RuleInput> ruleInputs = session.collectInputs(ruleC, outputStorage);
  assertThat(ruleInputs, hasSize(2));
  assertThat(ruleInputs, containsInAnyOrder(new RuleInput(tagB1, Sets.newHashSet(tagA1, tagB1)), new RuleInput(tagB2, Sets.newHashSet(tagA2, tagB2))));
}
origin: inspectIT/inspectIT

String input = "input";
Multimap<String, RuleOutput> outputMap = ArrayListMultimap.create();
Tag tagA = Tags.tag("A", input, Tags.rootTag(input));
Tag tagB = Tags.tag("B", input, tagA);
Tag tagC = Tags.tag("C", input, tagB);
origin: inspectIT/inspectIT

@Test(expectedExceptions = RuntimeException.class)
public void collectProblemInstancesWithRuntimeExceptionProblemContext() {
  CauseStructure causeStructure = new CauseStructure(CauseType.SINGLE, SourceType.TIMERDATA);
  AggregatedDiagnosisData aggregatedInvocationSequenceData = null;
  aggregatedInvocationSequenceData = DiagnosisDataAggregator.getInstance().getAggregatedDiagnosisData(secondChildSequence);
  DiagnosisDataAggregator.getInstance().aggregate(aggregatedInvocationSequenceData, secondChildSequence);
  Multimap<String, Tag> tagMap = ArrayListMultimap.create();
  Tag tagOne = new Tag(RuleConstants.DIAGNOSIS_TAG_GLOBAL_CONTEXT, secondChildSequence, Tags.rootTag(secondChildSequence));
  Tag tagTwo = new Tag(RuleConstants.DIAGNOSIS_TAG_PROBLEM_CONTEXT, "Test", tagOne);
  Tag tagThree = new Tag(RuleConstants.DIAGNOSIS_TAG_PROBLEM_CAUSE, aggregatedInvocationSequenceData, tagTwo);
  Tag tagFour = new Tag(RuleConstants.DIAGNOSIS_TAG_CAUSE_STRUCTURE, causeStructure, tagThree);
  tagMap.put("D", tagFour);
  when(sessionContext.getInput()).thenReturn(secondChildSequence);
  when(sessionContext.getStorage()).thenReturn(storage);
  when(storage.mapTags(TagState.LEAF)).thenReturn(tagMap);
  ProblemOccurrenceResultCollector problemInstanceResultCollector = new ProblemOccurrenceResultCollector();
  List<ProblemOccurrence> problemOccurrence = problemInstanceResultCollector.collect(sessionContext);
  assertThat(problemOccurrence, hasSize(0));
}
origin: inspectIT/inspectIT

@Test(expectedExceptions = RuntimeException.class)
public void collectProblemInstancesWithRuntimeExceptionCauseStructure() {
  AggregatedDiagnosisData aggregatedInvocationSequenceData = null;
  aggregatedInvocationSequenceData = DiagnosisDataAggregator.getInstance().getAggregatedDiagnosisData(secondChildSequence);
  DiagnosisDataAggregator.getInstance().aggregate(aggregatedInvocationSequenceData, secondChildSequence);
  Multimap<String, Tag> tagMap = ArrayListMultimap.create();
  Tag tagOne = new Tag(RuleConstants.DIAGNOSIS_TAG_GLOBAL_CONTEXT, secondChildSequence, Tags.rootTag(secondChildSequence));
  Tag tagTwo = new Tag(RuleConstants.DIAGNOSIS_TAG_PROBLEM_CONTEXT, new CauseCluster(secondChildSequence), tagOne);
  Tag tagThree = new Tag(RuleConstants.DIAGNOSIS_TAG_PROBLEM_CAUSE, aggregatedInvocationSequenceData, tagTwo);
  Tag tagFour = new Tag(RuleConstants.DIAGNOSIS_TAG_CAUSE_STRUCTURE, "Test", tagThree);
  tagMap.put("D", tagFour);
  when(sessionContext.getInput()).thenReturn(secondChildSequence);
  when(sessionContext.getStorage()).thenReturn(storage);
  when(storage.mapTags(TagState.LEAF)).thenReturn(tagMap);
  ProblemOccurrenceResultCollector problemInstanceResultCollector = new ProblemOccurrenceResultCollector();
  List<ProblemOccurrence> problemOccurrence = problemInstanceResultCollector.collect(sessionContext);
  assertThat(problemOccurrence, hasSize(0));
}
origin: inspectIT/inspectIT

@Test
public void collectProblemInstances() {
  CauseStructure causeStructure = new CauseStructure(CauseType.SINGLE, SourceType.TIMERDATA);
  AggregatedDiagnosisData aggregatedInvocationSequenceData = DiagnosisDataAggregator.getInstance().getAggregatedDiagnosisData(secondChildSequence);
  DiagnosisDataAggregator.getInstance().aggregate(aggregatedInvocationSequenceData, secondChildSequence);
  Multimap<String, Tag> tagMap = ArrayListMultimap.create();
  Tag tagOne = new Tag(RuleConstants.DIAGNOSIS_TAG_GLOBAL_CONTEXT, secondChildSequence, Tags.rootTag(secondChildSequence));
  Tag tagTwo = new Tag(RuleConstants.DIAGNOSIS_TAG_PROBLEM_CONTEXT, new CauseCluster(secondChildSequence), tagOne);
  Tag tagThree = new Tag(RuleConstants.DIAGNOSIS_TAG_PROBLEM_CAUSE, aggregatedInvocationSequenceData, tagTwo);
  Tag tagFour = new Tag(RuleConstants.DIAGNOSIS_TAG_CAUSE_STRUCTURE, causeStructure, tagThree);
  tagMap.put("Test", tagFour);
  when(sessionContext.getInput()).thenReturn(secondChildSequence);
  when(sessionContext.getStorage()).thenReturn(storage);
  when(storage.mapTags(TagState.LEAF)).thenReturn(tagMap);
  ProblemOccurrenceResultCollector problemInstanceResultCollector = new ProblemOccurrenceResultCollector();
  List<ProblemOccurrence> problemOccurrence = problemInstanceResultCollector.collect(sessionContext);
  assertThat(problemOccurrence, hasSize(1));
}
origin: inspectIT/inspectIT

@Test(expectedExceptions = RuntimeException.class)
public void collectProblemInstancesWithRuntimeExceptionRootCause() {
  CauseStructure causeStructure = new CauseStructure(CauseType.SINGLE, SourceType.TIMERDATA);
  AggregatedDiagnosisData aggregatedInvocationSequenceData = null;
  aggregatedInvocationSequenceData = DiagnosisDataAggregator.getInstance().getAggregatedDiagnosisData(secondChildSequence);
  DiagnosisDataAggregator.getInstance().aggregate(aggregatedInvocationSequenceData, secondChildSequence);
  Multimap<String, Tag> tagMap = ArrayListMultimap.create();
  Tag tagOne = new Tag(RuleConstants.DIAGNOSIS_TAG_GLOBAL_CONTEXT, secondChildSequence, Tags.rootTag(secondChildSequence));
  Tag tagTwo = new Tag(RuleConstants.DIAGNOSIS_TAG_PROBLEM_CONTEXT, new CauseCluster(secondChildSequence), tagOne);
  Tag tagThree = new Tag(RuleConstants.DIAGNOSIS_TAG_PROBLEM_CAUSE, "Test", tagTwo);
  Tag tagFour = new Tag(RuleConstants.DIAGNOSIS_TAG_CAUSE_STRUCTURE, causeStructure, tagThree);
  tagMap.put("D", tagFour);
  when(sessionContext.getInput()).thenReturn(secondChildSequence);
  when(sessionContext.getStorage()).thenReturn(storage);
  when(storage.mapTags(TagState.LEAF)).thenReturn(tagMap);
  ProblemOccurrenceResultCollector problemInstanceResultCollector = new ProblemOccurrenceResultCollector();
  List<ProblemOccurrence> problemOccurrence = problemInstanceResultCollector.collect(sessionContext);
  assertThat(problemOccurrence, hasSize(0));
}
origin: inspectIT/inspectIT

@Test(expectedExceptions = RuntimeException.class)
public void collectProblemInstancesWithRuntimeExceptionGlobalContext() {
  CauseStructure causeStructure = new CauseStructure(CauseType.SINGLE, SourceType.TIMERDATA);
  AggregatedDiagnosisData aggregatedInvocationSequenceData = null;
  aggregatedInvocationSequenceData = DiagnosisDataAggregator.getInstance().getAggregatedDiagnosisData(secondChildSequence);
  DiagnosisDataAggregator.getInstance().aggregate(aggregatedInvocationSequenceData, secondChildSequence);
  Multimap<String, Tag> tagMap = ArrayListMultimap.create();
  Tag tagOne = new Tag(RuleConstants.DIAGNOSIS_TAG_GLOBAL_CONTEXT, "Test", Tags.rootTag(secondChildSequence));
  Tag tagTwo = new Tag(RuleConstants.DIAGNOSIS_TAG_PROBLEM_CONTEXT, new CauseCluster(secondChildSequence), tagOne);
  Tag tagThree = new Tag(RuleConstants.DIAGNOSIS_TAG_PROBLEM_CAUSE, aggregatedInvocationSequenceData, tagTwo);
  Tag tagFour = new Tag(RuleConstants.DIAGNOSIS_TAG_CAUSE_STRUCTURE, causeStructure, tagThree);
  tagMap.put("D", tagFour);
  when(sessionContext.getInput()).thenReturn(secondChildSequence);
  when(sessionContext.getStorage()).thenReturn(storage);
  when(storage.mapTags(TagState.LEAF)).thenReturn(tagMap);
  ProblemOccurrenceResultCollector problemInstanceResultCollector = new ProblemOccurrenceResultCollector();
  List<ProblemOccurrence> problemOccurrence = problemInstanceResultCollector.collect(sessionContext);
  assertThat(problemOccurrence, hasSize(0));
}
rocks.inspectit.server.diagnosis.engine.tagTagsrootTag

Javadoc

Factory method to create the root Tag of type #ROOT_TAG.

Popular methods of Tags

  • tag
    Factory method to create a new Tag.
  • tags
    Factory method to create a collection of Tags.
  • unwrap
    Unwraps all requested parents from a Tag. Since a Tags carries it's predecessor it is possible to ex

Popular in Java

  • Reactive rest calls using spring rest template
  • compareTo (BigDecimal)
  • requestLocationUpdates (LocationManager)
  • getApplicationContext (Context)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • JFrame (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now