Peter Centgraf pushed to branch release/1.0 at cms-community / hippo-configuration-management
Commits: 88c71333 by Peter Centgraf at 2017-10-04T13:04:30+02:00 HCM-214 Module.sequenceNumber (Double) => Module.lastExecutedAction (String) (cherry picked from commit 0fa6eaf0526ab3800c709de347dfe02fcb7dfde4) - - - - - 4 changed files: - api/src/main/java/org/onehippo/cm/model/Module.java - model/src/main/java/org/onehippo/cm/model/impl/ModuleImpl.java - model/src/main/java/org/onehippo/cm/model/parser/ActionListParser.java - model/src/test/java/org/onehippo/cm/model/parser/ActionListParserTest.java Changes: ===================================== api/src/main/java/org/onehippo/cm/model/Module.java ===================================== --- a/api/src/main/java/org/onehippo/cm/model/Module.java +++ b/api/src/main/java/org/onehippo/cm/model/Module.java @@ -81,11 +81,11 @@ public interface Module extends OrderableByName { * @return the current "sequence number" of this module, which describes the most recent set of actions from * {@link #getActionsMap()} that have been applied to the JCR */ - Double getSequenceNumber(); + String getLastExecutedAction(); /** * @return The immutable map of action items per version, which describe how to handle content source bootstrapping */ - Map<Double, Set<ActionItem>> getActionsMap(); + Map<String, Set<ActionItem>> getActionsMap(); } ===================================== model/src/main/java/org/onehippo/cm/model/impl/ModuleImpl.java ===================================== --- a/model/src/main/java/org/onehippo/cm/model/impl/ModuleImpl.java +++ b/model/src/main/java/org/onehippo/cm/model/impl/ModuleImpl.java @@ -94,9 +94,9 @@ public class ModuleImpl implements Module, Comparable<Module>, Cloneable { private final List<WebFileBundleDefinitionImpl> webFileBundleDefinitions = new ArrayList<>(); - private Map<Double, Set<ActionItem>> actionsMap = new LinkedHashMap<>(); + private Map<String, Set<ActionItem>> actionsMap = new LinkedHashMap<>(); - private Double sequenceNumber; + private String lastExecutedAction; private ResourceInputProvider configResourceInputProvider; @@ -131,7 +131,7 @@ public class ModuleImpl implements Module, Comparable<Module>, Cloneable { modifiableAfter.addAll(module.getAfter()); configResourceInputProvider = module.getConfigResourceInputProvider(); contentResourceInputProvider = module.getContentResourceInputProvider(); - sequenceNumber = module.sequenceNumber; + lastExecutedAction = module.lastExecutedAction; actionsMap.putAll(module.getActionsMap()); // TODO: the following two methods require ModuleImpl access, but clone/creation should only use/need Module interface @@ -226,17 +226,17 @@ public class ModuleImpl implements Module, Comparable<Module>, Cloneable { } @Override - public Map<Double, Set<ActionItem>> getActionsMap() { + public Map<String, Set<ActionItem>> getActionsMap() { return actionsMap; } @Override - public Double getSequenceNumber() { - return sequenceNumber; + public String getLastExecutedAction() { + return lastExecutedAction; } - public void setSequenceNumber(double value) { - sequenceNumber = value; + public void setLastExecutedAction(String value) { + lastExecutedAction = value; } /** @@ -664,7 +664,7 @@ public class ModuleImpl implements Module, Comparable<Module>, Cloneable { // probably not needed as archive module aren't supposed to (need to) be cloned newModule.setArchiveFile(archiveFile); - newModule.sequenceNumber = sequenceNumber; + newModule.lastExecutedAction = lastExecutedAction; newModule.getActionsMap().putAll(actionsMap); // reload sources from raw YAML instead of attempting to copy the full parsed structure ===================================== model/src/main/java/org/onehippo/cm/model/parser/ActionListParser.java ===================================== --- a/model/src/main/java/org/onehippo/cm/model/parser/ActionListParser.java +++ b/model/src/main/java/org/onehippo/cm/model/parser/ActionListParser.java @@ -59,10 +59,9 @@ public class ActionListParser extends AbstractBaseParser { final NodeTuple nodeTuple = mappingNode.getValue().get(0); final String strVersion = asScalar(nodeTuple.getKeyNode()).getValue(); - final Double version = Double.parseDouble(strVersion); final Set<ActionItem> actionItems = collectActionItems(nodeTuple.getValueNode()); - module.getActionsMap().put(version, actionItems); + module.getActionsMap().put(strVersion, actionItems); } } ===================================== model/src/test/java/org/onehippo/cm/model/parser/ActionListParserTest.java ===================================== --- a/model/src/test/java/org/onehippo/cm/model/parser/ActionListParserTest.java +++ b/model/src/test/java/org/onehippo/cm/model/parser/ActionListParserTest.java @@ -39,10 +39,10 @@ public class ActionListParserTest extends AbstractBaseTest { @Test public void testLoad() throws ParserException { InputStream stream = this.getClass().getResourceAsStream("/parser/value_test/hcm-actions.yaml"); - Map<Double, Set<ActionItem>> actionsMap = parseActionMap(stream); + Map<String, Set<ActionItem>> actionsMap = parseActionMap(stream); assertTrue(actionsMap.size() == 3); - Set<ActionItem> actionItemsV1 = actionsMap.get(1.0d); + Set<ActionItem> actionItemsV1 = actionsMap.get("1.0"); assertTrue(actionItemsV1.size() == 2); assertEquals(ActionType.RELOAD, actionItemsV1.iterator().next().getType()); } @@ -77,11 +77,11 @@ public class ActionListParserTest extends AbstractBaseTest { } } - private Map<Double, Set<ActionItem>> parseActionMap(final String yaml) throws ParserException { + private Map<String, Set<ActionItem>> parseActionMap(final String yaml) throws ParserException { return parseActionMap(IOUtils.toInputStream(yaml, StandardCharsets.UTF_8)); } - private Map<Double, Set<ActionItem>> parseActionMap(final InputStream inputStream) throws ParserException { + private Map<String, Set<ActionItem>> parseActionMap(final InputStream inputStream) throws ParserException { ActionListParser parser = new ActionListParser(); GroupImpl group = new GroupImpl("group"); ProjectImpl project = new ProjectImpl("project", group); View it on GitLab: https://code.onehippo.org/cms-community/hippo-configuration-management/commit/88c71333f4441ff18c099b9e2e99c6c880615085 --- View it on GitLab: https://code.onehippo.org/cms-community/hippo-configuration-management/commit/88c71333f4441ff18c099b9e2e99c6c880615085 You're receiving this email because of your account on code.onehippo.org.
_______________________________________________ Hippocms-svn mailing list Hippocms-svn@lists.onehippo.org https://lists.onehippo.org/mailman/listinfo/hippocms-svn