Skip to content

Commit

Permalink
Updated checkstyle settings with a suppression filter.
Browse files Browse the repository at this point in the history
First check suppressed is for package.html in the test/* direcories, as
these are not actually required.

Also resored sort order settings for OU tests.
  • Loading branch information
aKandzior committed Mar 28, 2014
1 parent b7739ad commit 259cd07
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 27 deletions.
9 changes: 9 additions & 0 deletions CheckStyle_OpenCms_Suppression.xml
@@ -0,0 +1,9 @@
<?xml version="1.0"?>

<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">

<suppressions>
<suppress checks="JavadocPackage" files="test/*"/>
</suppressions>
3 changes: 3 additions & 0 deletions Checkstyle_OpenCms.xml
Expand Up @@ -112,4 +112,7 @@
<module name="JavadocPackage">
<property name="allowLegacy" value="true"/>
</module>
<module name="SuppressionFilter">
<property name="file" value="${project_loc}/CheckStyle_OpenCms_Suppression.xml"/>
</module>
</module>
54 changes: 27 additions & 27 deletions test/org/opencms/security/TestOrganizationalUnits.java
Expand Up @@ -144,33 +144,6 @@ public TestOrganizationalUnits(String arg0) {
super(arg0);
}

/**
* Returns the list of associated resource root paths.<p>
*
* @param cms the cms context
* @param ou the organizational unit to get the resources for
*
* @throws CmsException if something goes wrong
*/
private void assertOrgUnitResources(CmsObject cms, CmsOrganizationalUnit ou) throws CmsException {

List resourceList = new ArrayList();
Iterator itResources = OpenCms.getOrgUnitManager().getResourcesForOrganizationalUnit(cms, ou.getName()).iterator();
while (itResources.hasNext()) {
CmsResource resource = (CmsResource)itResources.next();
resourceList.add(resource.getRootPath());
}
List relations = cms.getRelationsForResource(
cms.getSitePath(cms.readResource(ou.getId())),
CmsRelationFilter.TARGETS);
assertEquals(relations.size(), resourceList.size());
Iterator itRelations = relations.iterator();
while (itRelations.hasNext()) {
CmsRelation relation = (CmsRelation)itRelations.next();
assertTrue(resourceList.contains(relation.getTargetPath()));
}
}

/**
* Tests ou creation with illegal name.<p>
*
Expand Down Expand Up @@ -1629,4 +1602,31 @@ public void testWebuserOU() throws Throwable {
// check resources
assertTrue(OpenCms.getOrgUnitManager().getResourcesForOrganizationalUnit(cms, ou.getName()).isEmpty());
}

/**
* Returns the list of associated resource root paths.<p>
*
* @param cms the cms context
* @param ou the organizational unit to get the resources for
*
* @throws CmsException if something goes wrong
*/
private void assertOrgUnitResources(CmsObject cms, CmsOrganizationalUnit ou) throws CmsException {

List resourceList = new ArrayList();
Iterator itResources = OpenCms.getOrgUnitManager().getResourcesForOrganizationalUnit(cms, ou.getName()).iterator();
while (itResources.hasNext()) {
CmsResource resource = (CmsResource)itResources.next();
resourceList.add(resource.getRootPath());
}
List relations = cms.getRelationsForResource(
cms.getSitePath(cms.readResource(ou.getId())),
CmsRelationFilter.TARGETS);
assertEquals(relations.size(), resourceList.size());
Iterator itRelations = relations.iterator();
while (itRelations.hasNext()) {
CmsRelation relation = (CmsRelation)itRelations.next();
assertTrue(resourceList.contains(relation.getTargetPath()));
}
}
}

0 comments on commit 259cd07

Please sign in to comment.