Revision 9181
Added by Jing Tao over 9 years ago
test/edu/ucsb/nceas/metacat/dataone/SolrQueryAccessFilterTest.java | ||
---|---|---|
25 | 25 |
import org.dataone.client.rest.RestClient; |
26 | 26 |
import org.dataone.client.auth.CertificateManager; |
27 | 27 |
import org.dataone.configuration.Settings; |
28 |
import org.dataone.service.exceptions.ServiceFailure; |
|
28 | 29 |
import org.dataone.service.types.v1.AccessPolicy; |
29 | 30 |
import org.dataone.service.types.v1.AccessRule; |
30 | 31 |
import org.dataone.service.types.v1.Identifier; |
... | ... | |
274 | 275 |
} |
275 | 276 |
System.out.println("================The MODIFIED base url is "+baseURL); |
276 | 277 |
MNode mnNode = D1Client.getMN(baseURL); |
277 |
input = mnNode.query(querySession, SOLR, generateQuery(id.getValue())); |
|
278 |
doc = generateDoc(input); |
|
279 |
String resultId2 = extractElementValue(doc, IDXPATH); |
|
280 |
assertTrue("In the testDistrustCertificate method, the query result id should be null", resultId2==null); |
|
278 |
try { |
|
279 |
input = mnNode.query(querySession, SOLR, generateQuery(id.getValue())); |
|
280 |
fail("Can't reach here since it is an untrusted certificate"); |
|
281 |
} catch (Exception e) { |
|
282 |
System.out.println("The exception is "+e.getMessage()); |
|
283 |
System.out.println("the exception class is "+e.getClass().getCanonicalName()); |
|
284 |
assertTrue(e instanceof ServiceFailure); |
|
285 |
} |
|
286 |
|
|
287 |
//doc = generateDoc(input); |
|
288 |
//String resultId2 = extractElementValue(doc, IDXPATH); |
|
289 |
//assertTrue("In the testDistrustCertificate method, the query result id should be null", resultId2==null); |
|
281 | 290 |
archive(session, id); |
282 | 291 |
|
283 | 292 |
} |
Also available in: Unified diff
Now for the untrusted certificate, the client throws an exception rather than returning null.