Search in sources :

Example 1 with XIssueExpression

use of com.avaloq.tools.ddk.check.check.XIssueExpression in project dsl-devkit by dsldevkit.

the class CheckMarkerHelpExtensionTest method testCheckHasTwoIssueCodes.

/**
 * Tests if a marker help element is added if an additional issueCode is added to an existing check.
 *
 * @throws Exception
 *           the exception
 */
@Test
public void testCheckHasTwoIssueCodes() throws Exception {
    IPluginExtension extension = createMarkerHelpExtension(parser.parse(CATALOG_WITH_FIRST_CHECK_LIVE));
    CheckCatalog twoIssueCodes = parser.parse(CATALOG_CHECK_HAS_TWO_ISSUECODES);
    markerUtil.updateExtension(twoIssueCodes, extension);
    List<String> issueCodesOfCheck = Lists.newArrayList();
    for (final XIssueExpression i : generatorExtension.issues(twoIssueCodes.getChecks().get(0))) {
        issueCodesOfCheck.add(CheckGeneratorExtensions.issueCodeValue(twoIssueCodes.getChecks().get(0), CheckGeneratorExtensions.issueCode(i)));
    }
    List<String> issueCodesInExtension = Lists.newArrayList();
    for (IPluginObject obj : extension.getChildren()) {
        for (IPluginObject element : ((IPluginElement) obj).getChildren()) {
            issueCodesInExtension.add(((IPluginElement) element).getAttribute(CheckMarkerHelpExtensionHelper.ATTRIBUTE_VALUE_TAG).getValue());
        }
    }
    assertTrue("A marker help element for both issueCodes has been created.", Iterables.elementsEqual(issueCodesInExtension, issueCodesOfCheck));
    assertEquals("extension has two marker help elements", 2, issueCodesInExtension.size());
}
Also used : IPluginExtension(org.eclipse.pde.core.plugin.IPluginExtension) XIssueExpression(com.avaloq.tools.ddk.check.check.XIssueExpression) IPluginElement(org.eclipse.pde.core.plugin.IPluginElement) IPluginObject(org.eclipse.pde.core.plugin.IPluginObject) CheckCatalog(com.avaloq.tools.ddk.check.check.CheckCatalog) Test(org.junit.Test)

Aggregations

CheckCatalog (com.avaloq.tools.ddk.check.check.CheckCatalog)1 XIssueExpression (com.avaloq.tools.ddk.check.check.XIssueExpression)1 IPluginElement (org.eclipse.pde.core.plugin.IPluginElement)1 IPluginExtension (org.eclipse.pde.core.plugin.IPluginExtension)1 IPluginObject (org.eclipse.pde.core.plugin.IPluginObject)1 Test (org.junit.Test)1