public void doTestParseErrorPreferencesComponent() throws BackingStoreException, CoreException {
    project = getProjectHandle(projectName);
    Package_c testPkg =
        Package_c.getOneEP_PKGOnR1401(
            m_sys,
            new ClassQueryInterface_c() {

              @Override
              public boolean evaluate(Object candidate) {
                return ((Package_c) candidate).getName().equals("Component-Test");
              }
            });
    setProjectPreference(
        BridgePointProjectActionLanguagePreferences.ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE,
        true);
    setProjectPreference(
        BridgePointProjectActionLanguagePreferences
            .ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE_REALIZED,
        false);
    IMarker[] errors = parseModel(testPkg);
    assertEquals("Incorrect number of parse errors were found.", 0, errors.length);
    ExternalEntity_c ee =
        ExternalEntity_c.getOneS_EEOnR8001(
            PackageableElement_c.getManyPE_PEsOnR8000(
                Package_c.getManyEP_PKGsOnR8001(
                    PackageableElement_c.getManyPE_PEsOnR8003(
                        Component_c.getManyC_CsOnR8001(
                            PackageableElement_c.getManyPE_PEsOnR8000(testPkg))))));
    Bridge_c bridge = Bridge_c.getOneS_BRGOnR19(ee);
    bridge.setAction_semantics_internal("// test comment");
    errors = parseModel(testPkg);
    assertEquals("Incorrect number of parse errors were found.", 1, errors.length);
    setProjectPreference(
        BridgePointProjectActionLanguagePreferences
            .ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE_REALIZED,
        true);
    errors = parseModel(testPkg);
    assertEquals("Incorrect number of parse errors were found.", 5, errors.length);
    setProjectPreference(
        BridgePointProjectActionLanguagePreferences
            .ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE_REALIZED,
        false);
    setProjectPreference(
        BridgePointProjectActionLanguagePreferences.ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE,
        false);
    errors = parseModel(testPkg);
    assertEquals("Incorrect number of parse errors were found.", 1, errors.length);
  }
Ejemplo n.º 2
0
  private void populateBridgeInstances() {
    class EE_test1_c implements ClassQueryInterface_c {
      EE_test1_c(String p) {
        m_p = p;
      }

      private String m_p;

      public boolean evaluate(Object inst) {
        ExternalEntity_c selected = (ExternalEntity_c) inst;
        return selected.getKey_lett().equals(m_p);
      }
    }
    ExternalEntity_c testEE =
        ExternalEntity_c.ExternalEntityInstance(arrayModelRoot, new EE_test1_c("T")); // $NON-NLS-1$
    if (testEE == null) fail("Unknown external entity T"); // $NON-NLS-1$
    class Bridge_test1_c implements ClassQueryInterface_c {
      Bridge_test1_c(String p) {
        m_p = p;
      }

      private String m_p;

      public boolean evaluate(Object inst) {
        Bridge_c selected = (Bridge_c) inst;
        return selected.getName().equals(m_p);
      }
    }
    for (int i = 0; i < funcs.length; ++i) {
      Bridge_c testFunc = Bridge_c.BridgeInstance(arrayModelRoot, new Bridge_test1_c(funcs[i]));
      if (testFunc != null) {
        if (m_testBrg[i] == null) m_testBrg[i] = testFunc;
      } else fail("Missing bridge " + funcs[i]); // $NON-NLS-1$
    }
  }
Ejemplo n.º 3
0
 public boolean evaluate(Object inst) {
   Bridge_c selected = (Bridge_c) inst;
   return selected.getName().equals(m_p);
 }