示例#1
0
  @SuppressWarnings("nls")
  public void testAccessors() {
    Criteria criteria = new Criteria();
    criteria.setAsyncMessageReturnSelected(true);
    criteria.setAsyncMessageSelected(true);
    criteria.setCaseSenstiveSelected(true);
    criteria.setLifeLineSelected(true);
    criteria.setStopSelected(true);
    criteria.setSyncMessageReturnSelected(true);
    criteria.setSyncMessageSelected(true);
    criteria.setExpression("test.*");

    // set true to all flags
    assertTrue("testAccessors", criteria.isAsyncMessageReturnSelected());
    assertTrue("testAccessors", criteria.isAsyncMessageSelected());
    assertTrue("testAccessors", criteria.isCaseSenstiveSelected());
    assertTrue("testAccessors", criteria.isLifeLineSelected());
    assertTrue("testAccessors", criteria.isStopSelected());
    assertTrue("testAccessors", criteria.isSyncMessageReturnSelected());
    assertTrue("testAccessors", criteria.isSyncMessageSelected());
    assertEquals("testAccessors", "test.*", criteria.getExpression());
    assertNotNull("testAccessors", criteria.getPattern());
    assertEquals("testAccessors", "test.*", criteria.getPattern().pattern());
    assertEquals("testAccessors", 0, criteria.getPattern().flags() & Pattern.CASE_INSENSITIVE);

    // set false to all flags
    criteria.setAsyncMessageReturnSelected(false);
    criteria.setAsyncMessageSelected(false);
    criteria.setCaseSenstiveSelected(false);
    criteria.setLifeLineSelected(false);
    criteria.setStopSelected(false);
    criteria.setSyncMessageReturnSelected(false);
    criteria.setSyncMessageSelected(false);

    assertFalse("testAccessors", criteria.isAsyncMessageReturnSelected());
    assertFalse("testAccessors", criteria.isAsyncMessageSelected());
    assertFalse("testAccessors", criteria.isCaseSenstiveSelected());
    assertFalse("testAccessors", criteria.isLifeLineSelected());
    assertFalse("testAccessors", criteria.isStopSelected());
    assertFalse("testAccessors", criteria.isSyncMessageReturnSelected());
    assertFalse("testAccessors", criteria.isSyncMessageSelected());
    assertEquals("testAccessors", "test.*", criteria.getExpression());
    assertNotNull("testAccessors", criteria.getPattern());
    assertEquals("testAccessors", "test.*", criteria.getPattern().pattern());
    assertEquals(
        "testAccessors",
        Pattern.CASE_INSENSITIVE,
        criteria.getPattern().flags() & Pattern.CASE_INSENSITIVE);
  }
示例#2
0
  @SuppressWarnings("nls")
  public void testCriteriaCriteria() {
    Criteria criteria = new Criteria();
    criteria.setExpression("test");
    criteria.setLifeLineSelected(true);
    criteria.setSyncMessageSelected(true);

    Criteria copy = new Criteria(criteria);

    assertEquals(
        "testCriteriaCriteria",
        criteria.isAsyncMessageReturnSelected(),
        copy.isAsyncMessageReturnSelected());
    assertEquals(
        "testCriteriaCriteria", criteria.isAsyncMessageSelected(), copy.isAsyncMessageSelected());
    assertEquals(
        "testCriteriaCriteria", criteria.isCaseSenstiveSelected(), copy.isCaseSenstiveSelected());
    assertEquals("testCriteriaCriteria", criteria.isLifeLineSelected(), copy.isLifeLineSelected());
    assertEquals("testCriteriaCriteria", criteria.isStopSelected(), copy.isStopSelected());
    assertEquals(
        "testCriteriaCriteria",
        criteria.isSyncMessageReturnSelected(),
        copy.isSyncMessageReturnSelected());
    assertEquals(
        "testCriteriaCriteria", criteria.isSyncMessageSelected(), copy.isSyncMessageSelected());
    assertEquals("testCriteriaCriteria", criteria.getExpression(), copy.getExpression());
    assertEquals(
        "testCriteriaCriteria", criteria.getPattern().pattern(), copy.getPattern().pattern());
  }
示例#3
0
  @SuppressWarnings("nls")
  public void testCompareTo() {
    Criteria criteria = new Criteria();
    criteria.setExpression("test");
    criteria.setLifeLineSelected(true);
    criteria.setSyncMessageSelected(true);

    Criteria copy = new Criteria(criteria);
    assertTrue("testCompareTo", criteria.compareTo(copy));
    assertTrue("testCompareTo", copy.compareTo(criteria));
    assertTrue("testCompareTo", criteria.compareTo(criteria));

    copy.setExpression(null);
    assertFalse("testCompareTo", criteria.compareTo(copy));
    assertFalse("testCompareTo", copy.compareTo(criteria));

    criteria.setExpression(null);
    assertTrue("testCompareTo", criteria.compareTo(copy));
    assertTrue("testCompareTo", copy.compareTo(criteria));

    criteria.setExpression("test");
    copy.setExpression("test.*[12345]");
    assertFalse("testCompareTo", criteria.compareTo(copy));
    assertFalse("testCompareTo", copy.compareTo(criteria));

    copy.setExpression("test");
    copy.setAsyncMessageReturnSelected(true);
    assertFalse("testCompareTo", criteria.compareTo(copy));
    assertFalse("testCompareTo", copy.compareTo(criteria));
  }
示例#4
0
  @SuppressWarnings("nls")
  public void testLoad() {
    DialogSettings settings = new DialogSettings("mysettings");

    Criteria criteria = new Criteria();
    criteria.setExpression("test");
    criteria.setLifeLineSelected(true);
    criteria.setSyncMessageSelected(true);

    // Save the criteria to the dialog settings
    criteria.save(settings);

    // Load the criteria from the dialog settings
    Criteria copy = new Criteria();
    copy.load(settings);

    assertTrue("testCompareTo", criteria.compareTo(copy));
    assertTrue("testCompareTo", copy.compareTo(criteria));
  }
示例#5
0
  @SuppressWarnings("nls")
  public void testSave() {
    DialogSettings settings = new DialogSettings("mysettings");

    Criteria criteria = new Criteria();
    criteria.setExpression("test");
    criteria.setLifeLineSelected(true);
    criteria.setSyncMessageSelected(true);

    // Save the criteria to the dialog settings
    criteria.save(settings);

    // Check if all values are saved as expected
    assertEquals("testSave", "test", settings.get("expression"));
    assertEquals("testSave", "false", settings.get("isCaseSenstiveSelected"));
    assertEquals("testSave", "false", settings.get("isAsyncMessageReturnSelected"));
    assertEquals("testSave", "false", settings.get("isAsyncMessageSelected"));
    assertEquals("testSave", "true", settings.get("isLifeLineSelected"));
    assertEquals("testSave", "false", settings.get("isStopSelected"));
    assertEquals("testSave", "false", settings.get("isSyncMessageReturnSelected"));
    assertEquals("testSave", "true", settings.get("isSyncMessageSelected"));
  }
示例#6
0
  @SuppressWarnings("nls")
  public void testGetGraphNodeSummary() {

    // Create a dummy provider
    ISDFilterProvider provider =
        new ISDFilterProvider() {

          @Override
          public boolean isNodeSupported(int nodeType) {
            return true;
          }

          @Override
          public String getNodeName(int nodeType, String loaderClassName) {
            // not clear about purpose loaderClassName
            switch (nodeType) {
              case ISDGraphNodeSupporter.LIFELINE:
                return "MyLifeline";
              case ISDGraphNodeSupporter.SYNCMESSAGE:
                return "MySyncMessage";
              case ISDGraphNodeSupporter.SYNCMESSAGERETURN:
                return "MySyncMessageReturn";
              case ISDGraphNodeSupporter.ASYNCMESSAGE:
                return "MyAsyncMessage";
              case ISDGraphNodeSupporter.ASYNCMESSAGERETURN:
                return "MyAsyncMessageReturn";
              case ISDGraphNodeSupporter.STOP:
                return "MyStop";
              default:
                return "";
            }
          }

          @Override
          public boolean filter(List<?> filters) {
            return false;
          }
        };

    Criteria criteria = new Criteria();
    criteria.setExpression("BALL_.*");
    criteria.setAsyncMessageReturnSelected(true);
    criteria.setAsyncMessageSelected(true);
    criteria.setLifeLineSelected(true);
    criteria.setStopSelected(true);
    criteria.setSyncMessageReturnSelected(true);
    criteria.setSyncMessageSelected(true);

    // Test summary when provider is available
    String summary = criteria.getGraphNodeSummary(provider, null);
    assertEquals(
        "testGetGraphNodeSummary",
        "[MyLifeline or MySyncMessage or MySyncMessageReturn or MyAsyncMessage or MyAsyncMessageReturn or MyStop]",
        summary);

    // Test default summary when no provider is provided
    summary = criteria.getGraphNodeSummary(null, null);
    assertEquals(
        "testGetGraphNodeSummary",
        "[Lifeline or Synchronous message or Synchronous message return or Asynchronous message or Asynchronous message return or Stop]",
        summary);
  }