Test 2
This commit is contained in:
@@ -2,4 +2,4 @@
|
||||
logging.level.com.bayer=DEBUG
|
||||
#logging.level.com.bayer.edam.migration.interceptors=INFO
|
||||
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} %-5level- %msg%n
|
||||
logging.file=application.log
|
||||
logging.file=application_2017-11-16_QA_2.log
|
||||
|
||||
@@ -49,7 +49,7 @@ public class Definitions {
|
||||
users = new HashMap<String, String>();
|
||||
|
||||
// XXX QA values
|
||||
classifications.put("Migration.Test", new WriteClassification("704deb515e024874a4a0a82700a4dc78", 1));
|
||||
classifications.put("Migration.Test", new WriteClassification("c07e583879a2409a8536a82d00f0ef5c", 1));
|
||||
|
||||
classifications.put("Migration", new WriteClassification("2bd24882-b7d8-4d30-8e6f-a7ef00eb33e7", 1));
|
||||
classifications.put("Migration.Logos", new WriteClassification("de96f8db1de44cc6841ba81c00b9db8e", 1));
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.client.HttpStatusCodeException;
|
||||
import org.springframework.web.client.ResourceAccessException;
|
||||
import org.springframework.web.client.RestClientException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import com.bayer.edam.migration.adam.Campaign;
|
||||
@@ -69,7 +70,8 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
|
||||
static final String mamHost = "https://service.media-assistant.animalhealth.bayer.com";
|
||||
|
||||
static final String fileCache = "E:\\";
|
||||
// XXX
|
||||
static final String fileCache = "E:\\_TEST\\";
|
||||
|
||||
static final String categoryJson = "resources/2017-10-19_categories.json";
|
||||
static final String categoryMapping = "resources/Media_Assistant_Categories_131017_EDITED_without_archive.csv";
|
||||
@@ -153,7 +155,7 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
}
|
||||
|
||||
int entryCounter = 1;
|
||||
HttpEntity<String> entity = new HttpEntity<String>("", mamHeaders);
|
||||
// HttpEntity<String> entity = new HttpEntity<String>("", mamHeaders);
|
||||
for (long id : entrySelection) {
|
||||
|
||||
// XXX
|
||||
@@ -163,7 +165,7 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
|
||||
|
||||
|
||||
log.info("GET entry " + id + " (" + entryCounter++ + ")");
|
||||
log.info("GET entry " + id + " (" + entryCounter++ + "/" + entrySelection.size() + ")");
|
||||
|
||||
// Entry entry = restTemplate.exchange(mamHost + "/rest/migration/entry/{id}", HttpMethod.GET, entity, Entry.class, id).getBody();
|
||||
Entry entry = entryMap.get(id);
|
||||
@@ -641,9 +643,9 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
}
|
||||
|
||||
}
|
||||
catch (ResourceAccessException rae) {
|
||||
log.error("Could not upload " + file.getAbsolutePath() + " (" + isMaster + ") for " + recordLocation + " from entry " + entry.id + ": " + rae.getMessage());
|
||||
rae.printStackTrace();
|
||||
catch (RestClientException rce) {
|
||||
log.error("FILE RESULT Could not upload " + file.getAbsolutePath() + " (" + isMaster + ") for " + recordLocation + " from entry " + entry.id + ": " + rce.getMessage());
|
||||
rce.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -679,15 +681,17 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
ResponseEntity<Void> response = restTemplate.exchange(Definitions.adamHost + reference.targetRecord, HttpMethod.PUT, httpEntity, Void.class);
|
||||
log.debug("Response: " + response.toString());
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error("Exception while attaching file to record " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
catch (RestClientException rce) {
|
||||
log.error("ATTACH RESULT Exception while attaching file " + reference.cachePath + " (" + reference.isMaster + ") for " + reference.targetRecord + ": " + rce.getMessage());
|
||||
rce.printStackTrace();
|
||||
}
|
||||
|
||||
log.debug("ATTACH RESULT Attached " + reference.cachePath + " (" + reference.isMaster + ") to " + reference.targetRecord);
|
||||
processedReferences.add(reference);
|
||||
}
|
||||
else {
|
||||
log.debug("Checking status of " + reference.cachePath + " for " + reference.uri);
|
||||
try {
|
||||
UploadResult result = restTemplate.exchange(Definitions.adamHost + reference.uri, HttpMethod.GET, adamHeadersEntity, UploadResult.class).getBody();
|
||||
log.debug("Result: " + result);
|
||||
|
||||
@@ -702,6 +706,10 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (RestClientException rce) {
|
||||
log.error("Failed to check status of " + reference.cachePath + " for " + reference.uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
openUploads.removeAll(processedReferences);
|
||||
|
||||
Reference in New Issue
Block a user