|
From: <rob...@us...> - 2010-06-22 07:28:52
|
Revision: 30
http://andspidclient.svn.sourceforge.net/andspidclient/?rev=30&view=rev
Author: robertbridle
Date: 2010-06-22 07:28:46 +0000 (Tue, 22 Jun 2010)
Log Message:
-----------
ANDSWRON-675 - Removed TestAndsPidClient.testListHandles() since it takes too long to run and doesn't buy us anything.
Modified Paths:
--------------
trunk/src/test/java/au/csiro/pidclient/TestAndsPidClient.java
Modified: trunk/src/test/java/au/csiro/pidclient/TestAndsPidClient.java
===================================================================
--- trunk/src/test/java/au/csiro/pidclient/TestAndsPidClient.java 2010-06-22 07:17:06 UTC (rev 29)
+++ trunk/src/test/java/au/csiro/pidclient/TestAndsPidClient.java 2010-06-22 07:28:46 UTC (rev 30)
@@ -519,26 +519,27 @@
"Either this type of value is not allowed to be deleted, or a value does not exist at the provided index"));
}
- /**
- * Test listHandles service: method responsible for listing the handles owned by the requestor.
- * <p>
- * Note: this test may take awhile to run.
- *
- * @throws Exception
- */
- public final void testListHandles() throws Exception
- {
- AndsPidClient client = this.createDummyANDPIDClient();
-
- AndsPidResponse response = client.listHandlesFormattedResponse();
-
- // should succeed
- assertTrue("Operation success expected, but response indicated failure", response.isSuccess());
+// This test has been removed, it does not provide us with much and can take up to 10 min+ to run.
+// /**
+// * Test listHandles service: method responsible for listing the handles owned by the requestor.
+// * <p>
+// * Note: this test may take awhile to run.
+// *
+// * @throws Exception
+// */
+// public final void testListHandles() throws Exception
+// {
+// AndsPidClient client = this.createDummyANDPIDClient();
+//
+// AndsPidResponse response = client.listHandlesFormattedResponse();
+//
+// // should succeed
+// assertTrue("Operation success expected, but response indicated failure", response.isSuccess());
+//
+// // there must be at least 1 handle associated with the current requestor (i.e. we minted a handle in setUp() method)
+// assertTrue("Response didn't have a handle", !response.getHandles().isEmpty());
+// }
- // there must be at least 1 handle associated with the current requestor (i.e. we minted a handle in setUp() method)
- assertTrue("Response didn't have a handle", !response.getHandles().isEmpty());
- }
-
/**
* Test getHandle service: method responsible for retrieving the values associated with a handle
*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jav...@us...> - 2012-08-03 04:04:42
|
Revision: 174
http://andspidclient.svn.sourceforge.net/andspidclient/?rev=174&view=rev
Author: javinovich
Date: 2012-08-03 04:04:35 +0000 (Fri, 03 Aug 2012)
Log Message:
-----------
DMSTECH-3819:
- Use brute force to ignore this unit tests that depend on ANDS PID service.
Modified Paths:
--------------
trunk/src/test/java/au/csiro/pidclient/TestAndsPidClient.java
Modified: trunk/src/test/java/au/csiro/pidclient/TestAndsPidClient.java
===================================================================
--- trunk/src/test/java/au/csiro/pidclient/TestAndsPidClient.java 2012-08-03 03:58:27 UTC (rev 173)
+++ trunk/src/test/java/au/csiro/pidclient/TestAndsPidClient.java 2012-08-03 04:04:35 UTC (rev 174)
@@ -31,7 +31,8 @@
* @author Rita Chen on 8/02/2010
* @version $Revision: 7131 $ $Date: 2010-06-09 14:25:15 +1000 (Wed, 09 Jun 2010) $
*/
-public class TestAndsPidClient extends TestCase
+public class TestAndsPidClient
+//extends TestCase
{
// /** CSIRO requester info: values required for connecting to PID Service */
// private static final String ANDS_HOST = "test.ands.org.au";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jav...@us...> - 2012-08-03 03:58:34
|
Revision: 173
http://andspidclient.svn.sourceforge.net/andspidclient/?rev=173&view=rev
Author: javinovich
Date: 2012-08-03 03:58:27 +0000 (Fri, 03 Aug 2012)
Log Message:
-----------
DMSTECH-3819:
- Use brute force to ignore this unit tests that depend on ANDS PID service.
Modified Paths:
--------------
trunk/src/test/java/au/csiro/pidclient/TestAndsPidClient.java
Modified: trunk/src/test/java/au/csiro/pidclient/TestAndsPidClient.java
===================================================================
--- trunk/src/test/java/au/csiro/pidclient/TestAndsPidClient.java 2012-08-03 03:11:20 UTC (rev 172)
+++ trunk/src/test/java/au/csiro/pidclient/TestAndsPidClient.java 2012-08-03 03:58:27 UTC (rev 173)
@@ -33,589 +33,589 @@
*/
public class TestAndsPidClient extends TestCase
{
- /** CSIRO requester info: values required for connecting to PID Service */
- private static final String ANDS_HOST = "test.ands.org.au";
- private static final int ANDS_PORT = 8443;
- private static final String ANDS_PATH = "/pids";
- private static final String APPID = "29bbb99a7a2446df5bf38a59631b2ca497730c9a";
- private static final String IDENTIFIER = "wron-repository-unit-tests";
- private static final String AUTHDOMAIN = "csiro.au";
- private static String TESTING_HANDLE = "";
-
- /*
- * (non-Javadoc)
- *
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception
- {
- super.setUp();
- // create a new handle, since we may run into a limit on the number of values we can associate with the one
- // handle.
- if ("".equals(TESTING_HANDLE)) // limit the number of handles we make
- {
- AndsPidClient client = this.createDummyANDPIDClient();
- AndsPidResponse response = client.mintHandleFormattedResponse(HandleType.URL,
- "http://test.org.au");
- TESTING_HANDLE = response.getHandle();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception
- {
- super.tearDown();
- }
-
- /**
- * Create a ANDPersistentIdentifierClient using CSIRO requester info
- *
- * @return a valid ANDPersistentIdentifierClient
- */
- private AndsPidClient createDummyANDPIDClient()
- {
- return new AndsPidClient(ANDS_HOST, ANDS_PORT, ANDS_PATH, APPID, IDENTIFIER, AUTHDOMAIN);
- }
-
- /**
- * Creates a dummy index value associated with the testing handle
- *
- * @param client
- * client class for calling the ANDS Persistent Identifier service
- * @return the index of the dummy value added to the handle, -1 if a dummy value was not added.
- */
- private int createDummyIndexValue(AndsPidClient client) throws Exception
- {
- AndsPidResponse response = client.addValueFormattedResponse(TESTING_HANDLE, HandleType.URL,
- "http://test.org.au/createDummyIndex");
-
- for (AndsPidResponseProperty responseProperty : response.getProperties())
- {
- if ("http://test.org.au/createDummyIndex".equals(responseProperty.getValue()))
- {
- return responseProperty.getIndex();
- }
- }
- return -1;
- }
-
- /**
- * Finds an unused index of the testing handle, an used index is one with no associated value
- *
- * @param client
- * client class for calling the ANDS Persistent Identifier service
- * @return an index with no associated value
- */
- private int findUnusedIndex(AndsPidClient client) throws Exception
- {
- AndsPidResponse response = client.getHandleFormattedResponse(TESTING_HANDLE);
-
- // create a set of all the indexes associated with our testing handle.
- Set<Integer> set = new HashSet<Integer>();
- for (AndsPidResponseProperty property : response.getProperties())
- {
- set.add(new Integer(property.getIndex()));
- }
-
- // find the first index from 0->99 that is not in our set (i.e. not associated with our testing handle)
- int unusedIndex = 0;
- for (; unusedIndex < 100; unusedIndex++)
- {
- if (set.contains(new Integer(unusedIndex)) == false)
- {
- break;
- }
- }
-
- return unusedIndex;
- }
-
- /**
- * Test connection cannot be established with invalid appId
- *
- * @throws Exception
- */
- public final void testInvalidAppId() throws Exception
- {
- AndsPidClient client = new AndsPidClient(ANDS_HOST, ANDS_PORT, ANDS_PATH, APPID
- + "123", IDENTIFIER, AUTHDOMAIN);
-
- String response = client.mintHandle(HandleType.URL, "http://test.org.au");
-
- // we should not be able to mint a handle with an invalid appId.
- assertTrue("Operation failure expectd, but response indicated success", response
- .indexOf("Authentication Failed") != -1);
- }
-
- /**
- * Test connection can be established with valid appId
- *
- * @throws Exception
- */
- public final void testValidAppId() throws Exception
- {
- AndsPidClient client = createDummyANDPIDClient();
-
- AndsPidResponse response = client.mintHandleFormattedResponse(HandleType.URL,
- "http://test.org.au");
-
- // should succeed
- assertTrue("Operation success expected, but response indicated failure", response.isSuccess());
- }
-
- /**
- * Test mint service: method responsible for the creation of a handle
- *
- * @throws Exception
- */
- public final void testMintValue() throws Exception
- {
- AndsPidClient client = this.createDummyANDPIDClient();
-
- AndsPidResponse response = client.mintHandleFormattedResponse(HandleType.URL,
- "http://test.org.au");
-
- // should succeed
- assertTrue("Operation success expected, but response indicated failure", response.isSuccess());
-
- // handle should be minted
- assertTrue("Response didn't contain handle info", !(response.getHandle()
- .equals(AndsPidResponse.NO_HANDLE_FOUND)));
-
- // whether value we specified was actually minted
- boolean found = false;
- for (AndsPidResponseProperty responseProperty : response.getProperties())
- {
- if ("http://test.org.au".equals(responseProperty.getValue()))
- {
- found = true;
- }
- }
- assertTrue("Could not find the value that was added in the response", found);
- }
-
- /**
- * Test mint service without specifying a value: method responsible for the creation of a handle
- *
- * @throws Exception
- */
- public final void testMintValueWithoutValue() throws Exception
- {
- AndsPidClient client = this.createDummyANDPIDClient();
-
- AndsPidResponse response = client.mintHandleFormattedResponse(HandleType.EMPTY,
- "");
-
- // should succeed
- assertTrue("Operation success expected, but response indicated failure", response.isSuccess());
-
- // handle should be minted
- assertTrue("Response didn't contain handle info", !(response.getHandle()
- .equals(AndsPidResponse.NO_HANDLE_FOUND)));
-
- // handle should not have a value
- assertTrue("Response contained index info", response.getProperties().size() == 0);
- }
-
- /**
- * Test mint service: method responsible for the creation of a handle with
- * an invalid URL.
- *
- * @throws Exception
- */
- public final void testMintHandleInvalidUrlValue() throws Exception
- {
- AndsPidClient client = this.createDummyANDPIDClient();
- AndsPidResponse response = client.mintHandleFormattedResponse(HandleType.URL,
- "www.test.org.au");
-
- // should fail
- assertFalse("Operation failure expected, but response indicated success", response.isSuccess());
-
- // check response message
- assertTrue("Response message incorrect - " + response.getMessage(), response.getMessage()
- .equals("The URL provided is invalid or not supported by this service"));
- }
-
- /**
- * Test mint service: method responsible for the creation of a handle
- * with a valid URL.
- * @throws Exception
- */
- public final void testMintHandleValidUrlValue() throws Exception
- {
- AndsPidClient client = this.createDummyANDPIDClient();
-
- AndsPidResponse response = client.mintHandleFormattedResponse(HandleType.URL,
- "http://test.org.au");
-
- // should fail
- assertTrue("Operation success expected, but response indicated failure", response.isSuccess());
-
- // check response message
- assertTrue("Response message incorrect - " + response.getMessage(), response.getMessage()
- .equals("Successfully authenticated and created handle"));
- }
-
- /**
- * Test mint service with an invalid index: method responsible for the creation of a handle with
- * an invalid index.
- *
- * @throws Exception
- */
- public final void testMintHandleInvalidIndexValue() throws Exception
- {
- AndsPidClient client = this.createDummyANDPIDClient();
-
- int index = -1; // negative indexes are invalid
-
- AndsPidResponse response = client.mintHandleFormattedResponse(HandleType.URL, index,
- "http://test.org.au");
-
- // should fail.
- assertFalse("Operation failure expected, but response indicated success", response.isSuccess());
-
- // check response message
- assertTrue("Response message incorrect - " + response.getMessage(), response.getMessage()
- .equals("Index must be numeric"));
- }
-
- /**
- * Test mint service with a valid index: method responsible for the creation of a handle with
- * and invalid index.
- *
- * @throws Exception
- */
- public final void testMintHandleValidIndexValue() throws Exception
- {
- AndsPidClient client = this.createDummyANDPIDClient();
-
- // ensure we don't have a value at some given index, e.g. 1
- int index = 1;
- client.deleteValueByIndex(TESTING_HANDLE, index);
-
- AndsPidResponse response = client.mintHandleFormattedResponse(HandleType.URL, index,
- "http://test.org.au");
-
- // we should be able to mint a value at an index that does not contain a value.
- assertTrue("Operation should not succeed, but response indicated success", response.isSuccess());
-
- // whether value we specified was actually minted
- boolean found = false;
- for (AndsPidResponseProperty responseProperty : response.getProperties())
- {
- if ("http://test.org.au".equals(responseProperty.getValue()))
- {
- found = true;
- }
- }
- assertTrue("Could not find the value that was added in the response", found);
- }
-
- /**
- * Test addValue service: method responsible for adding a value to an existing handle
- *
- * @throws Exception
- */
- public final void testAddValue() throws Exception
- {
- AndsPidClient client = this.createDummyANDPIDClient();
-
- AndsPidResponse response = client.addValueFormattedResponse(TESTING_HANDLE, HandleType.URL,
- "http://test.org.au/addValue");
-
- // should succeed
- assertTrue("Operation success expected, but response indicated failure", response.isSuccess());
-
- // handle should not alter
- assertEquals("Response didn't have the same handle", response.getHandle(), TESTING_HANDLE);
-
- // whether value we specified was actually added
- boolean found = false;
- for (AndsPidResponseProperty responseProperty : response.getProperties())
- {
- if ("http://test.org.au/addValue".equals(responseProperty.getValue()))
- {
- found = true;
- }
- }
- assertTrue("Could not find the value that was added in the response", found);
- }
-
- /**
- * Test addValueByIndex service with an invalid index: method responsible for adding a value to the index of an
- * existing handle
- *
- * @throws Exception
- */
- public final void testAddValueByIndexInvalidIndex() throws Exception
- {
- AndsPidClient client = this.createDummyANDPIDClient();
-
- int index = createDummyIndexValue(client); // get an index with a value associated with it
-
- AndsPidResponse response = client.addValueByIndexFormattedResponse(TESTING_HANDLE, index, HandleType.URL,
- "http://test.org.au/addValueByIndex");
-
- // we should not be able to add a value at an index that already contains a value.
- assertFalse("Operation should not succeed, but response indicated success", response.isSuccess());
-
- // check response message
- // assertTrue("Response message incorrect - " + response.getMessage(),
- // response.getMessage().equals("Request Failed. Index is reserved or in use"));
- }
-
- /**
- * Test addValueByIndex service with a valid index: method responsible for adding a value to the index of an
- * existing handle
- *
- * @throws Exception
- */
- public final void testAddValueByIndexValidIndex() throws Exception
- {
- AndsPidClient client = this.createDummyANDPIDClient();
-
- // ensure we don't have a value at the some given index, e.g. 1
- int index = 1;
- client.deleteValueByIndex(TESTING_HANDLE, index);
-
- AndsPidResponse response = client.addValueByIndexFormattedResponse(TESTING_HANDLE, index, HandleType.URL,
- "http://test.org.au/addValueByIndex");
-
- // we should be able to add a value at an index that does not contains a value.
- assertTrue("Operation should not succeed, but response indicated success", response.isSuccess());
-
- // handle should not alter
- assertEquals("Response didn't have the same handle", response.getHandle(), TESTING_HANDLE);
-
- // whether value we specified was actually added
- boolean found = false;
- for (AndsPidResponseProperty responseProperty : response.getProperties())
- {
- if ("http://test.org.au/addValueByIndex".equals(responseProperty.getValue()))
- {
- found = true;
- }
- }
- assertTrue("Could not find the value that was added in the response", found);
- }
-
- /**
- * Test modifyValueByIndex service: method responsible for changing a value associated with an existing handle
- *
- * @throws Exception
- */
- public final void XXtestModifyValueByIndex() throws Exception
- {
- AndsPidClient client = this.createDummyANDPIDClient();
-
- int index = createDummyIndexValue(client); // get an index with a value associated with it
-
- String goodValue = "http://javatest2.vm.csiro.au:8080/muradora/objectView.action?parentId=procite%3ApublicData&type=1&pid=csiro%3ADocument004";
-
- AndsPidResponse response = client.modifyValueByIndexFormattedResponse(TESTING_HANDLE, index,
- goodValue);
-
- // should succeed
- assertTrue("Operation success expected, but response indicated failure", response.isSuccess());
-
- // handle should not alter
- assertEquals("Response didn't have the same handle", response.getHandle(), TESTING_HANDLE);
-
- // whether index value was changed
- boolean found = false;
- for (AndsPidResponseProperty property : response.getProperties())
- {
- if (property.getIndex() == index)
- {
- found = true;
- assertEquals("The value associated with index: " + index + " was not updated by modifyValueByIndex",
- property.getValue(), goodValue);
- }
- }
- if (!found)
- {
- fail("Could not find index that was updated by modifyValueByIndex");
- }
- }
-
- /**
- * Test modifyValueByIndex service with an invalid index: method responsible for changing a value associated with an existing handle
- *
- * @throws Exception
- */
- public final void testModifyValueByInvalidIndex() throws Exception
- {
- AndsPidClient client = this.createDummyANDPIDClient();
-
- int index = this.findUnusedIndex(client); // get an index with no value associated with it
-
- AndsPidResponse response = client.modifyValueByIndexFormattedResponse(TESTING_HANDLE, index,
- "http://test.org.au/modifyValueByIndex");
-
- // we should not be able to modify a value at an index that does not contains a value.
- assertFalse("Operation should not succeed, but response indicated success", response.isSuccess());
-
- // check response message
- assertTrue("Response message incorrect - " + response.getMessage(), response.getMessage()
- .equals("Either this type of value is not allowed to be modified, a value does not exist at the provided index, or the value is not valid for the type"));
- }
-
- /**
- * Test deleteValueByIndex service: method responsible for deleting a value associated with an existing handle
- *
- * @throws Exception
- */
- public final void XXtestDeleteValueByIndex() throws Exception
- {
- AndsPidClient client = this.createDummyANDPIDClient();
-
- int index = createDummyIndexValue(client); // get an index with a value associated with it
-
- AndsPidResponse response = client.deleteValueByIndexFormattedResponse(TESTING_HANDLE, index);
-
- // should succeed
- // assertTrue("Operation success expected, but response indicated failure", response.isSuccess());
-
- // handle should not alter
- assertEquals("Response didn't have the same handle", response.getHandle(), TESTING_HANDLE);
-
- // whether index was deleted
- boolean found = false;
- for (AndsPidResponseProperty property : response.getProperties())
- {
- if (property.getIndex() == index)
- {
- found = true;
- }
- }
- assertFalse("Index and value still exist after they were deleted by modifyValueByIndex", found);
- }
-
- /**
- * Test deleteValueByIndex service with an invalid index: method responsible for deleting a value associated with an existing handle
- *
- * @throws Exception
- */
- public final void testDeleteValueByInvalidIndex() throws Exception
- {
- AndsPidClient client = this.createDummyANDPIDClient();
-
- int index = this.findUnusedIndex(client); // get an index with no value associated with it
-
- AndsPidResponse response = client.deleteValueByIndexFormattedResponse(TESTING_HANDLE, index);
-
- // we should not be able to delete a value at an index that does not contains a value.
- assertFalse("Operation should not succeed, but response indicated success", response.isSuccess());
-
- // check response message
- assertTrue(
- "Response message incorrect - " + response.getMessage(),
- response
- .getMessage()
- .equals(
- "Either this type of value is not allowed to be deleted, or a value does not exist at the provided index"));
- }
-
-// This test has been removed, it does not provide us with much and can take up to 10 min+ to run.
+// /** CSIRO requester info: values required for connecting to PID Service */
+// private static final String ANDS_HOST = "test.ands.org.au";
+// private static final int ANDS_PORT = 8443;
+// private static final String ANDS_PATH = "/pids";
+// private static final String APPID = "29bbb99a7a2446df5bf38a59631b2ca497730c9a";
+// private static final String IDENTIFIER = "wron-repository-unit-tests";
+// private static final String AUTHDOMAIN = "csiro.au";
+// private static String TESTING_HANDLE = "";
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see junit.framework.TestCase#setUp()
+// */
+// protected void setUp() throws Exception
+// {
+// super.setUp();
+// // create a new handle, since we may run into a limit on the number of values we can associate with the one
+// // handle.
+// if ("".equals(TESTING_HANDLE)) // limit the number of handles we make
+// {
+// AndsPidClient client = this.createDummyANDPIDClient();
+// AndsPidResponse response = client.mintHandleFormattedResponse(HandleType.URL,
+// "http://test.org.au");
+// TESTING_HANDLE = response.getHandle();
+// }
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see junit.framework.TestCase#tearDown()
+// */
+// protected void tearDown() throws Exception
+// {
+// super.tearDown();
+// }
+//
// /**
-// * Test listHandles service: method responsible for listing the handles owned by the requestor.
-// * <p>
-// * Note: this test may take awhile to run.
+// * Create a ANDPersistentIdentifierClient using CSIRO requester info
// *
+// * @return a valid ANDPersistentIdentifierClient
+// */
+// private AndsPidClient createDummyANDPIDClient()
+// {
+// return new AndsPidClient(ANDS_HOST, ANDS_PORT, ANDS_PATH, APPID, IDENTIFIER, AUTHDOMAIN);
+// }
+//
+// /**
+// * Creates a dummy index value associated with the testing handle
+// *
+// * @param client
+// * client class for calling the ANDS Persistent Identifier service
+// * @return the index of the dummy value added to the handle, -1 if a dummy value was not added.
+// */
+// private int createDummyIndexValue(AndsPidClient client) throws Exception
+// {
+// AndsPidResponse response = client.addValueFormattedResponse(TESTING_HANDLE, HandleType.URL,
+// "http://test.org.au/createDummyIndex");
+//
+// for (AndsPidResponseProperty responseProperty : response.getProperties())
+// {
+// if ("http://test.org.au/createDummyIndex".equals(responseProperty.getValue()))
+// {
+// return responseProperty.getIndex();
+// }
+// }
+// return -1;
+// }
+//
+// /**
+// * Finds an unused index of the testing handle, an used index is one with no associated value
+// *
+// * @param client
+// * client class for calling the ANDS Persistent Identifier service
+// * @return an index with no associated value
+// */
+// private int findUnusedIndex(AndsPidClient client) throws Exception
+// {
+// AndsPidResponse response = client.getHandleFormattedResponse(TESTING_HANDLE);
+//
+// // create a set of all the indexes associated with our testing handle.
+// Set<Integer> set = new HashSet<Integer>();
+// for (AndsPidResponseProperty property : response.getProperties())
+// {
+// set.add(new Integer(property.getIndex()));
+// }
+//
+// // find the first index from 0->99 that is not in our set (i.e. not associated with our testing handle)
+// int unusedIndex = 0;
+// for (; unusedIndex < 100; unusedIndex++)
+// {
+// if (set.contains(new Integer(unusedIndex)) == false)
+// {
+// break;
+// }
+// }
+//
+// return unusedIndex;
+// }
+//
+// /**
+// * Test connection cannot be established with invalid appId
+// *
// * @throws Exception
// */
-// public final void testListHandles() throws Exception
+// public final void testInvalidAppId() throws Exception
// {
+// AndsPidClient client = new AndsPidClient(ANDS_HOST, ANDS_PORT, ANDS_PATH, APPID
+// + "123", IDENTIFIER, AUTHDOMAIN);
+//
+// String response = client.mintHandle(HandleType.URL, "http://test.org.au");
+//
+// // we should not be able to mint a handle with an invalid appId.
+// assertTrue("Operation failure expectd, but response indicated success", response
+// .indexOf("Authentication Failed") != -1);
+// }
+//
+// /**
+// * Test connection can be established with valid appId
+// *
+// * @throws Exception
+// */
+// public final void testValidAppId() throws Exception
+// {
+// AndsPidClient client = createDummyANDPIDClient();
+//
+// AndsPidResponse response = client.mintHandleFormattedResponse(HandleType.URL,
+// "http://test.org.au");
+//
+// // should succeed
+// assertTrue("Operation success expected, but response indicated failure", response.isSuccess());
+// }
+//
+// /**
+// * Test mint service: method responsible for the creation of a handle
+// *
+// * @throws Exception
+// */
+// public final void testMintValue() throws Exception
+// {
// AndsPidClient client = this.createDummyANDPIDClient();
//
-// AndsPidResponse response = client.listHandlesFormattedResponse();
+// AndsPidResponse response = client.mintHandleFormattedResponse(HandleType.URL,
+// "http://test.org.au");
+//
+// // should succeed
+// assertTrue("Operation success expected, but response indicated failure", response.isSuccess());
+//
+// // handle should be minted
+// assertTrue("Response didn't contain handle info", !(response.getHandle()
+// .equals(AndsPidResponse.NO_HANDLE_FOUND)));
+//
+// // whether value we specified was actually minted
+// boolean found = false;
+// for (AndsPidResponseProperty responseProperty : response.getProperties())
+// {
+// if ("http://test.org.au".equals(responseProperty.getValue()))
+// {
+// found = true;
+// }
+// }
+// assertTrue("Could not find the value that was added in the response", found);
+// }
+//
+// /**
+// * Test mint service without specifying a value: method responsible for the creation of a handle
+// *
+// * @throws Exception
+// */
+// public final void testMintValueWithoutValue() throws Exception
+// {
+// AndsPidClient client = this.createDummyANDPIDClient();
//
+// AndsPidResponse response = client.mintHandleFormattedResponse(HandleType.EMPTY,
+// "");
+//
// // should succeed
// assertTrue("Operation success expected, but response indicated failure", response.isSuccess());
//
-// // there must be at least 1 handle associated with the current requestor (i.e. we minted a handle in setUp() method)
-// assertTrue("Response didn't have a handle", !response.getHandles().isEmpty());
+// // handle should be minted
+// assertTrue("Response didn't contain handle info", !(response.getHandle()
+// .equals(AndsPidResponse.NO_HANDLE_FOUND)));
+//
+// // handle should not have a value
+// assertTrue("Response contained index info", response.getProperties().size() == 0);
// }
-
- /**
- * Test getHandle service: method responsible for retrieving the values associated with a handle
- *
- * @throws Exception
- */
- public final void testGetHandle() throws Exception
- {
- AndsPidClient client = this.createDummyANDPIDClient();
-
- AndsPidResponse response = client.getHandleFormattedResponse(TESTING_HANDLE);
-
- // should succeed
- assertTrue("Operation success expected, but response indicated failure", response.isSuccess());
-
- // handle should not alter
- assertEquals("Response didn't have the same handle", response.getHandle(), TESTING_HANDLE);
- }
-
- /**
- * Test getHandle service with an invalid handle: method responsible for retrieving the values associated with a handle
- *
- * @throws Exception
- */
- public final void testGetInvalidHandle() throws Exception
- {
- AndsPidClient client = this.createDummyANDPIDClient();
-
- AndsPidResponse response = client.getHandleFormattedResponse("XXXXXX"); // an invalid handle
-
- // we should not be able to retrieve a handle that does not exist
- assertFalse("Operation should not succeed, but response indicated success", response.isSuccess());
-
- // check response message
- assertTrue("Response message incorrect - " + response.getMessage(), response.getMessage()
- .equals("The handle: XXXXXX was not found"));
- }
-
- /**
- * Test connection with an invalid AndsPidClient
- *
- * @throws Exception
- */
- public final void testInvalidConnection() throws Exception
- {
- AndsPidClient client = new AndsPidClient();
-
- try
- {
- client.mintHandle(HandleType.URL, "http://test.org.au");
- fail("Expected IllegalStateException when using no-args AndsPidClient constructor");
- }
- catch (IllegalStateException ise)
- {
- // ignore this because it means the test passed!
- }
- }
-
- /**
- * Test connection with an invalid Handle
- *
- * @throws Exception
- */
- public final void testInvalidHandle() throws Exception
- {
- AndsPidClient client = this.createDummyANDPIDClient();
-
- try
- {
- client.mintHandle(null, "http://test.org.au"); // null is an in...
[truncated message content] |