Java Code Examples for org.eclipse.wst.validation.internal.provisional.core.IMessage#NORMAL_SEVERITY

The following examples show how to use org.eclipse.wst.validation.internal.provisional.core.IMessage#NORMAL_SEVERITY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ValidationUtilsTest.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetOffsetMap_mixedXml() {
  problems.clear();
  byte[] bytes = MIXED_XML_WITH_PROJECT_ID.getBytes(StandardCharsets.UTF_8);
  DocumentLocation start = new DocumentLocation(3, 13);
  ElementProblem problem = new ElementProblem(
      "application", 
      "", 
      IMarker.SEVERITY_WARNING, 
      IMessage.NORMAL_SEVERITY, 
      start, 
      1, 
      null);
  problems.add(problem);
  Map<ElementProblem, Integer> map = ValidationUtils.getOffsetMap(bytes, problems, "UTF-8");
  assertEquals(1, map.size());
  int offset = map.get(problem);
  assertEquals(21, offset);
}
 
Example 2
Source File: XmlValidatorTest.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateMarker() throws CoreException {
  IFile file = createBogusProjectFile();
  String message = "Project ID should be specified at deploy time.";
  ElementProblem element = new ElementProblem(
      message,
      IMarker.PROBLEM,
      IMarker.SEVERITY_WARNING,
      IMessage.NORMAL_SEVERITY,
      new DocumentLocation(0, 0),
      0,
      null);
  XmlValidator.createMarker(file, element);
  IMarker[] markers = file.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_ZERO);
  ArrayAssertions.assertSize(1, markers);
  assertEquals(message, markers[0].getAttribute(IMarker.MESSAGE));
}
 
Example 3
Source File: ElementProblemTest.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Test
public void testElementProblemConstructor_nullElementName() {
  try {
    new ElementProblem(
        null,
        "org.eclipse.core.resources.problemmarker",
        IMarker.SEVERITY_WARNING,
        IMessage.NORMAL_SEVERITY,
        new DocumentLocation(4, 4),
        0,
        null);
    fail();
  } catch (NullPointerException ex) {
    assertNotNull(ex.getMessage());
  }
}
 
Example 4
Source File: ElementProblemTest.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Test
public void testElementProblemConstructor_nullLocation() {
  try {
    new ElementProblem(
        "test",
        "org.eclipse.core.resources.problemmarker",
        IMarker.SEVERITY_WARNING,
        IMessage.NORMAL_SEVERITY,
        null,
        0,
        null);
    fail();
  } catch (NullPointerException ex) {
    assertNotNull(ex.getMessage());
  }
}
 
Example 5
Source File: ElementProblemTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testHashCode() {
  ElementProblem element1 = new ElementProblem(
      "message",
      "marker",
      IMarker.SEVERITY_WARNING,
      IMessage.NORMAL_SEVERITY,
      new DocumentLocation(4, 4),
      0,
      null);
  ElementProblem element2 = new ElementProblem(
      "message",
      "marker",
      IMarker.SEVERITY_WARNING,
      IMessage.NORMAL_SEVERITY,
      new DocumentLocation(4, 4),
      0,
      null);;
  ElementProblem element3 = new ElementProblem(
      "message",
      "marker2",
      IMarker.SEVERITY_WARNING,
      IMessage.NORMAL_SEVERITY,
      new DocumentLocation(4, 4),
      0,
      null);;
  assertEquals(element1.hashCode(), element2.hashCode());
  assertNotEquals(element1.hashCode(), element3.hashCode());
}
 
Example 6
Source File: AppEngineDeprecatedElement.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
AppEngineDeprecatedElement(String elementName, DocumentLocation start, int length) {
  super(
    AppEngineWebProblems.getDeprecatedElementMessage(elementName),
    AppEngineWebProblems.getMarkerId(elementName),
    IMarker.SEVERITY_WARNING,
    IMessage.NORMAL_SEVERITY,
    start,
    length,
    AppEngineWebProblems.getQuickAssistProcessor(elementName));
}
 
Example 7
Source File: TypeScriptReporterCollector.java    From typescript.java with MIT License 5 votes vote down vote up
private int getSeverity(DiagnosticCategory category) {
	switch(category) {
	case Message:
		return IMessage.LOW_SEVERITY;
	case Warning:
		return IMessage.NORMAL_SEVERITY;
	default:
		return IMessage.HIGH_SEVERITY;
	}
}
 
Example 8
Source File: ReporterMessagePlacementStrategy.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
private static int severityFromIMarkerSeverity(int imarkerSeverity) {
  switch (imarkerSeverity) {
    case IMarker.SEVERITY_ERROR:
      return IMessage.HIGH_SEVERITY;

    case IMarker.SEVERITY_WARNING:
      return IMessage.NORMAL_SEVERITY;

    case IMarker.SEVERITY_INFO:
      return IMessage.LOW_SEVERITY;

    default:
      return IMessage.LOW_SEVERITY;
  }
}
 
Example 9
Source File: ElementProblemTest.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unlikely-arg-type")
@Test
public void testEquals() {
  ElementProblem element1 = new ElementProblem(
      "message",
      "marker",
      IMarker.SEVERITY_WARNING,
      IMessage.NORMAL_SEVERITY,
      new DocumentLocation(4, 4),
      0,
      null);
  assertEquals(element1, element1);
  
  ElementProblem element2 = new ElementProblem(
      "message",
      "marker",
      IMarker.SEVERITY_WARNING,
      IMessage.NORMAL_SEVERITY,
      new DocumentLocation(4, 4),
      0,
      null);
  assertTrue(element1.equals(element2));
  assertTrue(element2.equals(element1));
  
  ElementProblem element3 =
      new ElementProblem(
        "message", 
        "markerId_1", 
        IMarker.SEVERITY_WARNING, 
        IMessage.NORMAL_SEVERITY,
        new DocumentLocation(1, 1),
        20,
        null);
  ElementProblem element4 =
      new ElementProblem(
        "message",
        "markerId_2",
        IMarker.SEVERITY_WARNING, 
        IMessage.NORMAL_SEVERITY, 
        new DocumentLocation(1, 1), 
        20, 
        null);
  assertFalse(element3.equals(element4));
  
  ElementProblem element5 =
      new ElementProblem(
        "message",
        "markerId", 
        IMarker.SEVERITY_WARNING, 
        IMessage.NORMAL_SEVERITY, 
        new DocumentLocation(1, 1),
        20, 
        null);
  ElementProblem element6 =
      new ElementProblem("message",
        "markerId", 
        IMarker.SEVERITY_WARNING, 
        IMessage.NORMAL_SEVERITY, 
        new DocumentLocation(1, 15),
        20, 
        null);
  assertFalse(element5.equals(element6));
  
  ElementProblem element7 =
      new ElementProblem("message_1",
        "markerId", 
        IMarker.SEVERITY_WARNING, 
        IMessage.NORMAL_SEVERITY, 
        new DocumentLocation(1, 1), 
        20,
        null);
  ElementProblem element8 =
      new ElementProblem("message_2", 
        "markerId", 
        IMarker.SEVERITY_WARNING, 
        IMessage.NORMAL_SEVERITY, 
        new DocumentLocation(1, 1), 
        20, 
        null);
  assertFalse(element7.equals(element8));
  
  assertFalse(element1.equals(null));
  assertFalse(element1.equals("test"));
}
 
Example 10
Source File: MavenPluginElement.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
public MavenPluginElement(DocumentLocation start, int length) {
  super(message, markerId, IMarker.SEVERITY_WARNING, IMessage.NORMAL_SEVERITY,
      start, length, null /* Null IQuickAssistProcessor */);
}
 
Example 11
Source File: ObsoleteRuntime.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
ObsoleteRuntime(String message, DocumentLocation start, int length) {
  super(message, "com.google.cloud.tools.eclipse.appengine.validation.runtimeMarker",
      IMarker.SEVERITY_ERROR,
      IMessage.NORMAL_SEVERITY,
      start, length, AppEngineWebProblems.getQuickAssistProcessor("runtime"));
}