isLayeringValid()???????????? ?嵥 2?? DIRECTORY_TO_ANALYZE???????а?????????? ?????????嵥 4 ??????????÷??????? isEfferentsValid()?????????嵥 5 ?????

??????? isEfferentsValid()???????????????????????????????????????????????????????????????? 0????????? ?嵥 2?е? dataLayerViolations??????e???????????Υ???????????? testDataLayer()???????????? ?嵥 3?????????

?嵥 5. ?ж??????????Υ??

private boolean isLayeringValid(String layer?? Collection rules) {
  boolean rulesCorrect = true;
  Collection packages = jdepend.analyze();
  Iterator itor = packages.iterator();
  JavaPackage jPackage = null;
  String analyzedPackageName = null;
  while (itor.hasNext()) {
    jPackage = (JavaPackage) itor.next();
    analyzedPackageName = jPackage.getName();
    Iterator afferentItor = jPackage.getAfferents().iterator();
    String afferentPackageName = null;
    while (afferentItor.hasNext()) {
      JavaPackage afferentPackage = (JavaPackage) afferentItor.next();
      afferentPackageName = afferentPackage.getName();
    }
    rulesCorrect = isEfferentsValid
        (layer?? rules?? rulesCorrect?? jPackage?? analyzedPackageName);
  }
  return rulesCorrect;
}


????????????????嵥 2 ?? 5 ??????????????а?????????仯?? ???????????仯???????????????????? JUnit ??????????? ????????????????????????????

????????????в???

??????????? JUnit ?? JDepend ??д?????????????? ??????????? Ant ?? Maven ????????????????????????????????С? ??????????嵥 6 ???????? Ant ???????д??????? test.dependency.dir???? ??? root/src/test/java/dependency ???????а??????Щ??????????????

?嵥 6. ?????????????????? Ant ???


 <target name="run-tests" depends="compile-tests">
  <mkdir dir="${logs.junit.dir}" />
  <junit fork="yes" haltonfailure="true"dir="${basedir}" printsummary="yes">
    <classpath refid="test.class.path" />
    <classpath refid="project.class.path"/>
    <formatter type="plain" usefile="true" />
    <formatter type="xml" usefile="true" />
    <batchtest fork="yes" todir="${logs.junit.dir}">
      <fileset dir="${test.dependency.dir}">
        <patternset refid="test.sources.pattern"/>
      </fileset>
    </batchtest>
  </junit>   
 </target>


?? JUnit ????????У?JDepend JAR ????????? Ant ????·???С? haltonfailure ???????? true??????ù????????????????????

???????????

???????????????????????????????????????????? ???????????????????????????????к???????????Υ???? ???????????????????????????????У? ?????????????????????????????С?? 3 ??????????? Ant ????????????????????????????????????????????? JDepend ???????

? 3. ???Υ?????????????
???????

??????????????????????????????????????????????????? ?????????????????????????? —— ?????????????? ????????????????????????????????????????????????????????????????

????????????
JDepend ??????Щ?????

????????????? JDepend ?????????顣??????JDepend ????????? DependencyConstraint????????? DependencyConstraint ????????????????????????? ?????????? API ??м???????????????????????????????????????????????????Щ????????????????????? ????? ?ο?????????????????

?????????????????????????????????????????????Υ????? ????????????????????????????? —— ?????????????????????????????? Instability?????????????????????ж?????????彡????

??????????????????????????????????? ??ж??????????????????????????????????? ?????????ó???????????Continuous Integration system???? ???????Щ?????????????????磬??????汾???????????????Щ??????? —— ???????????θ??????????????????? ????????? JUnit ???????????? ??????????????????????????????????????????????????????