use of com.sun.enterprise.admin.servermgmt.xml.stringsubs.Group in project Payara by payara.
the class StringSubstitutionEngine method substituteGroups.
@Override
public void substituteGroups(List<String> groups) throws StringSubstitutionException {
if (!isValid(groups)) {
throw new StringSubstitutionException(_strings.get("missingGroupIdentifiers"));
}
for (String groupId : groups) {
Group group = findGroupById(groupId);
if (group == null) {
_logger.log(Level.WARNING, SLogger.MISSING_GROUP, groupId);
continue;
}
doSubstitution(group);
}
}
use of com.sun.enterprise.admin.servermgmt.xml.stringsubs.Group in project Payara by payara.
the class TestStringSubstitutionFactory method testStringSubstitutorValidStream.
/**
* Test String substitution for valid stream.
*/
@Test
public void testStringSubstitutorValidStream() {
InputStream invalidStream = TestStringSubstitutionFactory.class.getClassLoader().getResourceAsStream(_stringSubsPath);
try {
StringSubstitutor substitutor = StringSubstitutionFactory.createStringSubstitutor(invalidStream);
substitutor.setAttributePreprocessor(new AttributePreprocessorImpl(_substitutionMap));
backUpTestFile();
substitutor.substituteAll();
for (Group group : substitutor.getStringSubsDefinition().getGroup()) {
if (group.getId().equals(VALID_GROUP_ID)) {
validateSubstitutedArchiveEntries(group);
for (FileEntry fileEntry : group.getFileEntry()) {
if (fileEntry.getName().equalsIgnoreCase(_testFileName) && !validateTestFile(new File(fileEntry.getName()))) {
Assert.fail("Substitution failed in the test file.");
break;
}
}
}
}
restoreTestFile();
} catch (StringSubstitutionException e) {
Assert.fail("Exception occurred during string substitution process.", e);
}
}
Aggregations