Clean up/out some comments. DO NOT MERGE.
Change-Id: I16063cf9132e0f2d6556ce06e1ebfb90ecff05aa
diff --git a/libcore/security/src/test/java/org/apache/harmony/security/tests/java/security/CodeSourceTest.java b/libcore/security/src/test/java/org/apache/harmony/security/tests/java/security/CodeSourceTest.java
index 276dfd7..7cf12b5 100644
--- a/libcore/security/src/test/java/org/apache/harmony/security/tests/java/security/CodeSourceTest.java
+++ b/libcore/security/src/test/java/org/apache/harmony/security/tests/java/security/CodeSourceTest.java
@@ -40,23 +40,14 @@
import org.apache.harmony.security.tests.support.TestCertUtils;
import junit.framework.TestCase;
+
@TestTargetClass(CodeSource.class)
/**
* Unit test for CodeSource.
- *
+ *
*/
public class CodeSourceTest extends TestCase {
- /**
- *
- * Entry point for standalone runs.
- *
- * @param args command line arguments
- */
- public static void main(String[] args) throws Exception {
- junit.textui.TestRunner.run(CodeSourceTest.class);
- }
-
private java.security.cert.Certificate[] chain = null;
/* Below are various URLs used during the testing */
@@ -83,7 +74,7 @@
private static URL urlFileDirStar;
private static URL urlRef1, urlRef2;
-
+
private boolean init = false;
private void init() {
@@ -92,28 +83,28 @@
String siteName = "www.intel.com";
InetAddress addr = InetAddress.getByName(siteName);
String siteIP = addr.getHostAddress();
-
+
urlSite = new URL("http://"+siteName+"");
urlDir = new URL("http://"+siteName+"/drl_test");
urlDirOtherSite = new URL("http://www.any-other-site-which-is-not-siteName.com/drl_test");
-
+
urlDir_port80 = new URL("http://"+siteName+":80/drl_test");
urlDir_port81 = new URL("http://"+siteName+":81/drl_test");
urlDirWithSlash = new URL(urlDir + "/");
-
+
//urlDirFtp = new URL("ftp://www.intel.com/drl_test");
urlDir_FileProtocol = new URL("file://"+siteName+"/drl_test");
-
+
urlDirIP = new URL("http://"+siteIP+"/drl_test");
-
+
urlFile = new URL("http://"+siteName+"/drl_test/empty.jar");
urlFileWithAdditionalDirs = new URL(
"http://"+siteName+"/drl_test/what/ever/here/empty.jar");
-
+
urlFileDirMinus = new URL("http://"+siteName+"/drl_test/-");
urlFileDirStar = new URL("http://"+siteName+"/drl_test/*");
urlFileDirOtherDir = new URL("http://"+siteName+"/_test_drl_/*");
-
+
urlRef1 = new URL("http://"+siteName+"/drl_test/index.html#ref1");
urlRef2 = new URL("http://"+siteName+"/drl_test/index.html#ref2");
} catch (MalformedURLException ex) {
@@ -134,7 +125,7 @@
/**
* Tests hashCode().<br>
- * javadoc says nothing, so test DRL-specific implementation.
+ * javadoc says nothing, so test DRL-specific implementation.
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
@@ -143,7 +134,7 @@
args = {}
)
public void testHashCode() {
- // when nothing is specified, then hashCode obviously must be 0.
+ // when nothing is specified, then hashCode obviously must be 0.
assertTrue(new CodeSource(null, (Certificate[]) null).hashCode() == 0);
// only URL.hashCode is taken into account...
assertTrue(new CodeSource(urlSite, (Certificate[]) null).hashCode() == urlSite
@@ -217,7 +208,7 @@
/**
* Test for equals(Object)<br>
- * The signer certificate chain must contain the same set of certificates, but
+ * The signer certificate chain must contain the same set of certificates, but
* the order of the certificates is not taken into account.
*/
@TestTargetNew(
@@ -238,7 +229,7 @@
/**
* Test for equals(Object)<br>
- * Checks that both 'null' and not-null URLs are taken into account - properly.
+ * Checks that both 'null' and not-null URLs are taken into account - properly.
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
@@ -277,7 +268,7 @@
}
/**
- * Tests whether the getCertificates() returns certificates obtained from
+ * Tests whether the getCertificates() returns certificates obtained from
* the signers.
*/
@TestTargetNew(
@@ -295,19 +286,19 @@
CodeSigner[] signers = { new CodeSigner(cpath, null) };
CodeSource cs = new CodeSource(null, signers);
Certificate[] got = cs.getCertificates();
- // The set of certificates must be exactly the same,
+ // The set of certificates must be exactly the same,
// but the order is not specified
assertTrue(presented(certs, got));
assertTrue(presented(got, certs));
}
/**
- * Checks whether two arrays of certificates represent the same same set of
+ * Checks whether two arrays of certificates represent the same same set of
* certificates - in the same order.
- * @param one first array
+ * @param one first array
* @param two second array
- * @return <code>true</code> if both arrays represent the same set of
- * certificates,
+ * @return <code>true</code> if both arrays represent the same set of
+ * certificates,
* <code>false</code> otherwise.
*/
private static boolean checkEqual(java.security.cert.Certificate[] one,
@@ -342,10 +333,10 @@
/**
* Performs a test whether the <code>what</code> certificates are all
* presented in <code>where</code> certificates.
- *
+ *
* @param what - first array of Certificates
* @param where - second array of Certificates
- * @return <code>true</code> if each and every certificate from 'what'
+ * @return <code>true</code> if each and every certificate from 'what'
* (including null) is presented in 'where' <code>false</code> otherwise
*/
private static boolean presented(Certificate[] what, Certificate[] where) {
@@ -413,7 +404,7 @@
assertTrue(found);
}
}
-
+
/**
* Tests CodeSource.getCodeSigners() for null.
*/
@@ -424,7 +415,7 @@
args = {}
)
public void testGetCoderSignersNull() throws Exception{
- assertNull(new CodeSource(new URL("http://url"), (Certificate[])null).getCodeSigners()); //$NON-NLS-1$
+ assertNull(new CodeSource(new URL("http://url"), (Certificate[])null).getCodeSigners());
}
/**
@@ -453,7 +444,7 @@
args = {}
)
public void testToString() {
- // Javadoc keeps silence about String's format,
+ // Javadoc keeps silence about String's format,
// just make sure it can be invoked.
new CodeSource(urlSite, chain).toString();
new CodeSource(null, chain).toString();
@@ -462,9 +453,9 @@
/**
* Tests whether we are running with the 1.5 features.<br>
- * The test is preformed by looking for (via reflection) the CodeSource's
+ * The test is preformed by looking for (via reflection) the CodeSource's
* constructor {@link CodeSource#CodeSource(URL, CodeSigner[])}.
- * @return <code>true</code> if 1.5 feature is presented, <code>false</code>
+ * @return <code>true</code> if 1.5 feature is presented, <code>false</code>
* otherwise.
*/
private static boolean has_15_features() {
@@ -473,7 +464,7 @@
try {
klass.getConstructor(ctorArgs);
} catch (NoSuchMethodException ex) {
- // NoSuchMethod == Not RI.v1.5 and not DRL
+ // NoSuchMethod == Not RI.v1.5 and not DRL
return false;
}
return true;
@@ -512,9 +503,6 @@
assertFalse(thizCS.implies(thatCS));
}
- /**
- * If this object's location equals codesource's location, then return true.
- */
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "",
@@ -530,10 +518,6 @@
}
- /**
- * This object's protocol (getLocation().getProtocol()) must be equal to
- * codesource's protocol.
- */
/*
* FIXME
* commented out for temporary, as there is no FTP:// protocol supported yet.
@@ -559,11 +543,6 @@
assertFalse(thatCS.implies(thizCS));
}
- /**
- * If this object's host (getLocation().getHost()) is not null, then the
- * SocketPermission constructed with this object's host must imply the
- * SocketPermission constructed with codesource's host.
- */
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "",
@@ -577,7 +556,7 @@
assertTrue(thizCS.implies(thatCS));
assertTrue(thatCS.implies(thizCS));
- //
+ //
// Check for another site - force to create SocketPermission
//
thatCS = new CodeSource(urlDirOtherSite, (Certificate[]) null);
@@ -595,10 +574,6 @@
assertFalse(thatCS.implies(thizCS));
}
- /**
- * If this object's port (getLocation().getPort()) is not equal to -1 (that
- * is, if a port is specified), it must equal codesource's port.
- */
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "",
@@ -626,10 +601,6 @@
assertFalse(thizCS.implies(thatCS));
}
- /**
- * If this object's file (getLocation().getFile()) doesn't equal
- * codesource's file, then the following checks are made: ...
- */
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "",
@@ -642,10 +613,6 @@
assertTrue(thizCS.implies(thatCS));
}
- /**
- * ... If this object's file ends with "/-", then codesource's file must
- * start with this object's file (exclusive the trailing "-").
- */
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "",
@@ -664,11 +631,6 @@
assertFalse(thiz.implies(that));
}
- /**
- * ... If this object's file ends with a "/*", then codesource's file must
- * start with this object's file and must not have any further "/"
- * separators.
- */
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "",
@@ -690,10 +652,6 @@
assertFalse(thiz.implies(that));
}
- /**
- * ... If this object's file doesn't end with a "/", then codesource's file
- * must match this object's file with a '/' appended.
- */
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "",
@@ -708,10 +666,6 @@
assertFalse(thatCS.implies(thizCS));
}
- /**
- * If this object's reference (getLocation().getRef()) is not null, it must
- * equal codesource's reference.
- */
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "",
@@ -754,7 +708,7 @@
//
that = new CodeSource(urlSite, (Certificate[]) null);
- // 'thiz' has set of certs, while 'that' has no certs. URL-s are the
+ // 'thiz' has set of certs, while 'that' has no certs. URL-s are the
// same.
assertFalse(thiz.implies(that));
assertTrue(that.implies(thiz));
@@ -762,8 +716,8 @@
/**
* Testing with special URLs like 'localhost', 'file://' scheme ...
- * These special URLs have a special processing in implies(),
- * so they need to be covered and performance need to be checked
+ * These special URLs have a special processing in implies(),
+ * so they need to be covered and performance need to be checked
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
@@ -783,8 +737,8 @@
/**
* Testing with special URLs like 'localhost', 'file://' scheme ...
- * These special URLs have a special processing in implies(),
- * so they need to be covered and performance need to be checked
+ * These special URLs have a special processing in implies(),
+ * so they need to be covered and performance need to be checked
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
diff --git a/libcore/security/src/test/java/tests/security/cert/CollectionCertStoreParametersTest.java b/libcore/security/src/test/java/tests/security/cert/CollectionCertStoreParametersTest.java
index 551fda6..b194c70 100644
--- a/libcore/security/src/test/java/tests/security/cert/CollectionCertStoreParametersTest.java
+++ b/libcore/security/src/test/java/tests/security/cert/CollectionCertStoreParametersTest.java
@@ -36,9 +36,9 @@
import java.util.Vector;
import org.apache.harmony.security.tests.support.cert.MyCertificate;
+
/**
- * Tests for <code>CollectionCertStoreParameters</code>
- *
+ * Tests for <code>CollectionCertStoreParameters</code>.
*/
@TestTargetClass(CollectionCertStoreParameters.class)
public class CollectionCertStoreParametersTest extends TestCase {
@@ -49,8 +49,6 @@
/**
* Test #1 for <code>CollectionCertStoreParameters()</code> constructor<br>
- * Assertion: Creates an instance of CollectionCertStoreParameters
- * with the default parameter values (an empty and immutable Collection)
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
@@ -66,8 +64,6 @@
/**
* Test #2 for <code>CollectionCertStoreParameters</code> constructor<br>
- * Assertion: Creates an instance of CollectionCertStoreParameters
- * with the default parameter values (an empty and immutable Collection)
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
@@ -93,7 +89,6 @@
/**
* Test #1 for <code>CollectionCertStoreParameters(Collection)</code>
* constructor<br>
- * Assertion: Creates an instance of CollectionCertStoreParameters
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
@@ -110,9 +105,6 @@
/**
* Test #2 for <code>CollectionCertStoreParameters(Collection)</code>
* constructor<br>
- * Assertion: If the specified <code>Collection</code> contains an object
- * that is not a <code>Certificate</code> or <code>CRL</code>, that object
- * will be ignored by the Collection <code>CertStore</code>.
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
@@ -132,11 +124,6 @@
/**
* Test #3 for <code>CollectionCertStoreParameters(Collection)</code>
* constructor<br>
- * Assertion: The Collection is not copied. Instead, a reference is used.
- * This allows the caller to subsequently add or remove Certificates or
- * CRLs from the Collection, thus changing the set of Certificates or CRLs
- * available to the Collection CertStore. The Collection CertStore will
- * not modify the contents of the Collection
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
@@ -149,7 +136,7 @@
// create using empty collection
CollectionCertStoreParameters cp =
new CollectionCertStoreParameters(certificates);
- // check that the reference is used
+ // check that the reference is used
assertTrue("isRefUsed_1", certificates == cp.getCollection());
// check that collection still empty
assertTrue("isEmpty", cp.getCollection().isEmpty());
@@ -163,8 +150,6 @@
/**
* Test #4 for <code>CollectionCertStoreParameters(Collection)</code>
* constructor<br>
- * Assertion: <code>NullPointerException</code> - if
- * <code>collection</code> is <code>null</code>
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
@@ -182,7 +167,6 @@
/**
* Test #1 for <code>clone()</code> method<br>
- * Assertion: Returns a copy of this object
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
@@ -203,8 +187,6 @@
/**
* Test #2 for <code>clone()</code> method<br>
- * Assertion: ...only a reference to the <code>Collection</code>
- * is copied, and not the contents
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
@@ -225,8 +207,6 @@
/**
* Test #3 for <code>clone()</code> method<br>
- * Assertion: ...only a reference to the <code>Collection</code>
- * is copied, and not the contents
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
@@ -248,7 +228,6 @@
/**
* Test #1 for <code>toString()</code> method<br>
- * Assertion: returns the formatted string describing parameters
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
@@ -265,7 +244,6 @@
/**
* Test #2 for <code>toString()</code> method<br>
- * Assertion: returns the formatted string describing parameters
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
@@ -284,7 +262,6 @@
/**
* Test #1 for <code>getCollection()</code> method<br>
- * Assertion: returns the Collection (never null)
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
@@ -299,7 +276,6 @@
/**
* Test #2 for <code>getCollection()</code> method<br>
- * Assertion: returns the Collection (never null)
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,