- public void test() {
- // TODO: Ian [JUnit] This fails because these files don't exist
- assertTrue(true);
- // try {
- // PropAccess propAccess = new PropAccess("cadi_prop_files=/opt/app/aaf/common/com.att.aaf.common.props:/opt/app/aaf/common/com.att.aaf.props");
- // SecurityInfoC<HttpURLConnection> si = SecurityInfoC.instance(propAccess, HttpURLConnection.class);
- // String alu = propAccess.getProperty(Config.AAF_LOCATE_URL,"https://mithrilcsp.sbc.com:8095/locate");
- // URI locatorURI = new URI(alu+"/com.att.aaf.service/2.0");
- // AbsAAFLocator<BasicTrans> al = new AAFLocator(si, locatorURI);
- // Assert.assertTrue(al.refresh());
- // Item i = al.first();
- // i = al.next(i);
- // i = al.best();
- // } catch (Exception e) {
- // Assert.fail();
- // }
+ public void test() throws CadiException, URISyntaxException, LocatorException {
+ access.setProperty(Config.CADI_LATITUDE, "38.62"); // St Louis approx lat
+ access.setProperty(Config.CADI_LONGITUDE, "90.19"); // St Louis approx lon
+ SecurityInfoC<HttpURLConnection> si = SecurityInfoC.instance(access, HttpURLConnection.class);
+ String alu = access.getProperty(Config.AAF_LOCATE_URL,"https://mithrilcsp.sbc.com:8095/locate");
+ URI locatorURI = new URI(alu+"/com.att.aaf.service/2.0");
+ AbsAAFLocator<BasicTrans> al = new AAFLocator(si, locatorURI) {
+ @Override
+ protected HClient createClient(SecuritySetter<HttpURLConnection> ss, URI uri, int connectTimeout) throws LocatorException {
+ return clientMock;
+ }
+ };
+ assertThat(al.refresh(), is(true));
+ when(futureMock.get(1)).thenReturn(false);
+ assertThat(al.refresh(), is(false));
+ String errorMessage = errStream.toString().split(": ", 2)[1];
+ assertThat(errorMessage, is("Error reading location information from " + uriString + ": 0 null\n \n"));