// Get the translations with PO headers
ClientResponse<TranslationsResource> response =
transResource.getTranslations("my.txt", de_DE, new StringSet(
"gettext"), true, null);
TranslationsResource translations = response.getEntity();
assertThat(translations.getExtensions().size(), greaterThan(0));
// List of custom Zanata headers that should be present
final String[] requiredHeaders =
new String[] { HeaderFields.KEY_LastTranslator,
HeaderFields.KEY_PoRevisionDate,
HeaderFields.KEY_LanguageTeam, "X-Generator",
HeaderFields.KEY_Language };
for (String reqHeader : requiredHeaders) {
boolean headerFound = false;
for (HeaderEntry entry : translations.getExtensions()
.findByType(PoTargetHeader.class).getEntries()) {
if (entry.getKey().equals(reqHeader)) {
headerFound = true;
}
}
assertThat("PO Target Header '" + reqHeader
+ "' was not present when pulling translations.",
headerFound, is(true));
}
// Since it is a first push with no headers, the Last Translator and
// Last Revision Date header should be empty
for (HeaderEntry entry : translations.getExtensions()
.findByType(PoTargetHeader.class).getEntries()) {
if (entry.getKey().equals(HeaderFields.KEY_LastTranslator)
|| entry.getKey().equals(HeaderFields.KEY_PoRevisionDate)) {
assertThat(entry.getValue().trim(), is(""));
}