Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2009-06-23 18:00:00 +0000
committerChris Goldthorpe2009-06-23 18:00:00 +0000
commit1aa5eaee6949286982b9b88dd01216e721e94eeb (patch)
treed69354a68c71c8b042d431a0f8818cb4197a6d4a /org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc
parente0595fa6e9371d88cd981d2021a09503055771b9 (diff)
downloadeclipse.platform.ua-1aa5eaee6949286982b9b88dd01216e721e94eeb.tar.gz
eclipse.platform.ua-1aa5eaee6949286982b9b88dd01216e721e94eeb.tar.xz
eclipse.platform.ua-1aa5eaee6949286982b9b88dd01216e721e94eeb.zip
Bug 279522 – [Test] Seperate Link checker tests into generated/non generated
Diffstat (limited to 'org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc')
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocLinkChecker.java56
1 files changed, 48 insertions, 8 deletions
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocLinkChecker.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocLinkChecker.java
index 9c30baccf..cf300f593 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocLinkChecker.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocLinkChecker.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
package org.eclipse.ua.tests.help.toc;
import java.util.ArrayList;
+import java.util.List;
import org.eclipse.help.internal.validation.TocValidator;
import org.eclipse.help.internal.validation.TocValidator.BrokenLink;
@@ -22,6 +23,30 @@ import junit.framework.TestSuite;
public class TocLinkChecker extends TestCase {
+ private final class ReferenceFilter extends TocValidator.Filter {
+ public boolean isIncluded(String href) {
+ return href.startsWith("reference");
+ }
+ }
+
+ private final class NonReferenceFilter extends TocValidator.Filter {
+ public boolean isIncluded(String href) {
+ return !href.startsWith("reference");
+ }
+ }
+
+ private final class NonReferenceNonSampleFilter extends TocValidator.Filter {
+ public boolean isIncluded(String href) {
+ return !href.startsWith("reference") && !href.startsWith("samples");
+ }
+ }
+
+ private final class ReferenceOrSampleFilter extends TocValidator.Filter {
+ public boolean isIncluded(String href) {
+ return href.startsWith("reference") || href.startsWith("samples");
+ }
+ }
+
private static final String[] PLATFORM_USER = {"/org.eclipse.platform.doc.user/toc.xml"};
private static final String[] PLATFORM_ISV = {"/org.eclipse.platform.doc.isv/toc.xml"};
private static final String[] PDE_USER = {"/org.eclipse.pde.doc.user/toc.xml"};
@@ -36,14 +61,24 @@ public class TocLinkChecker extends TestCase {
ArrayList failures = TocValidator.validate(PLATFORM_USER);
doAssert(failures);
}
+
+ public void testPlatformIsvStatic() throws Exception {
+ ArrayList failures = TocValidator.filteredValidate(PLATFORM_ISV, new NonReferenceNonSampleFilter());
+ doAssert(failures);
+ }
- public void testPlatformIsv() throws Exception {
- ArrayList failures = TocValidator.validate(PLATFORM_ISV);
+ public void testPlatformIsvGenerated() throws Exception {
+ ArrayList failures = TocValidator.filteredValidate(PLATFORM_ISV, new ReferenceOrSampleFilter());
+ doAssert(failures);
+ }
+
+ public void testPdeUserStatic() throws Exception {
+ ArrayList failures = TocValidator.filteredValidate(PDE_USER, new NonReferenceFilter());
doAssert(failures);
}
- public void testPdeUser() throws Exception {
- ArrayList failures = TocValidator.validate(PDE_USER);
+ public void testPdeUserGenerated() throws Exception {
+ ArrayList failures = TocValidator.filteredValidate(PDE_USER, new ReferenceFilter());
doAssert(failures);
}
@@ -52,12 +87,17 @@ public class TocLinkChecker extends TestCase {
doAssert(failures);
}
- public void testJdtIsv() throws Exception {
- ArrayList failures = TocValidator.validate(JDT_ISV);
+ public void testJdtIsvStatic() throws Exception {
+ ArrayList failures = TocValidator.filteredValidate(JDT_ISV, new NonReferenceFilter());
+ doAssert(failures);
+ }
+
+ public void testJdtIsvGenerated() throws Exception {
+ ArrayList failures = TocValidator.filteredValidate(JDT_ISV, new ReferenceFilter());
doAssert(failures);
}
- private void doAssert(ArrayList failures) {
+ private void doAssert(List failures) {
StringBuffer message = new StringBuffer();
for (int i = 0; i < failures.size(); i++) {
BrokenLink link = (BrokenLink)failures.get(i);

Back to the top