Skip to content

Commit f707d11

Browse files
author
Niladree
committed
Merge branch 'master' of https://github.com/ukwa/w3act
2 parents 3ab950b + a59ae49 commit f707d11

File tree

4 files changed

+14
-24
lines changed

4 files changed

+14
-24
lines changed

app/controllers/APIController.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,13 @@ public static Result targetUpdate(Long id) throws ActException {
172172
}
173173
}
174174

175+
// check any crawl permission
176+
for( CrawlPermission cp: merged.crawlPermissions ) {
177+
Logger.debug("GOT: "+cp);
178+
Logger.debug("Checking: "+cp.contactPerson);
179+
cp.contactPerson.save();
180+
}
181+
175182
merged.runChecks();
176183
merged.update();
177184
String url = Play.application().configuration().getString("server_name") + Play.application().configuration().getString("application.context") + "/targets/" + merged.id;

app/uk/bl/scope/Scope.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ public static boolean isUKRegistrant( WhoisResult whoIsRes ) {
323323
* @throws WhoisException
324324
*/
325325
public boolean checkWhois(String url, Target target) {
326-
if( WHOIS_ENABLED == false ) {
326+
if( WHOIS_ENABLED != true ) {
327327
Logger.warn("WHOIS is currently disabled!");
328328
return false;
329329
}

test/LicenseInheritanceTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ public void run() {
103103
// Add some particular targets:
104104
Target bl = this.addTarget("British Library", new String[]{ "http://www.bl.uk" }, ScopeType.subdomains);
105105
Target bln = this.addTarget("British Library News", new String[]{ "http://www.bl.uk/news/" }, ScopeType.subdomains);
106-
Target bld = this.addTarget("British Library Datasets", new String[]{ "http://data.bl.uk/" }, null);
106+
Target bld = this.addTarget("British Library Datasets", new String[]{ "http://data.bl.uk/" }, ScopeType.root);
107107
Target eg = this.addTarget("Example", new String[]{ "http://example.com/" }, ScopeType.subdomains);
108-
Target egs = this.addTarget("Example Subdomain", new String[]{ "http://subdomain.example.com/" }, null);
109-
Target egss = this.addTarget("Example Subsection", new String[]{ "http://example.com/subsection/" }, null);
108+
Target egs = this.addTarget("Example Subdomain", new String[]{ "http://subdomain.example.com/" }, ScopeType.root);
109+
Target egss = this.addTarget("Example Subsection", new String[]{ "http://example.com/subsection/" }, ScopeType.root);
110110

111111
/***************** Perform some basic tests ******************/
112112
assertThat(eg.isInScopeAllOrInheritedWithoutLicense()).isFalse();
@@ -207,6 +207,8 @@ public void testWhois() throws ActException {
207207
Scope.WHOIS_ENABLED = true;
208208
boolean wr = Scope.INSTANCE.checkWhois(url, null);
209209
assertThat(wr).isTrue();
210+
// And clean up:
211+
Scope.WHOIS_ENABLED = false;
210212
}
211213

212214
}

test/api/APIIntegrationTests.java

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,25 +78,6 @@ public void run() {
7878

7979
}
8080

81-
82-
/**
83-
* Example from:
84-
*
85-
* https://www.playframework.com/documentation/2.2.x/JavaFunctionalTest
86-
*
87-
*/
88-
//@Test
89-
public void runInBrowser() {
90-
running(testServer(3333, fakeApplication(additionalConfigurations.asMap())), HTMLUNIT, new Callback<TestBrowser>() {
91-
public void invoke(TestBrowser browser) {
92-
browser.goTo("http://localhost:3333");
93-
assertThat(browser.$("#title").getTexts().get(0)).isEqualTo("Hello Guest");
94-
browser.$("a").click();
95-
assertThat(browser.url()).isEqualTo("http://localhost:3333/Coco");
96-
assertThat(browser.$("#title", 0).getText()).isEqualTo("Hello Coco");
97-
}
98-
});
99-
}
10081

10182
/*
10283
* Method to populate a running system with some test data.
@@ -105,7 +86,7 @@ private static Long populate(String host, String username, String password, Stri
10586
String one = "{\"title\": \""+title+"\", \"field_urls\": [\""+url+"\"],\"field_scope\": \""+scope+"\",\"field_crawl_start_date\": \""+start_date+"\", \"selector\": 1, \"field_crawl_frequency\": \"MONTHLY\" }";
10687
Promise<WS.Response> result = WS.url(host+"/api/targets").setAuth(username, password).setHeader("Content-Type", "application/json").post(one);
10788
WS.Response response = result.get(timeout_ms);
108-
Logger.info("GOT "+response.getStatus()+" "+response.getStatusText());
89+
Logger.info("populate GOT "+response.getStatus()+" "+response.getStatusText());
10990
assertThat(response.getStatus()).isEqualTo(expected);
11091
String loc = response.getHeader(LOCATION);
11192
Long id = Long.parseLong(loc.substring(loc.lastIndexOf('/')+1));

0 commit comments

Comments
 (0)