???????????
???????????? ???????[ 2013/2/28 9:44:18 ] ????????
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 ???????????? ??????????????????????????????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11