@Test(expected = IllegalArgumentException.class) public void test_publishDerivedComponents_null_componentSetId() throws Exception{ List<Component> components = new ArrayList<Component>(); components.add(component); getComponentService().publishDerivedComponents(null, components); }
@Override @Transactional public void publishDerivedComponents(String componentSetId, List<Component> components) { if (StringUtils.isBlank(componentSetId)) { throw new RiceIllegalArgumentException("componentSetId was a null or blank value"); } components = validateAndNormalizeComponents(componentSetId, components); LOG.info("Requesting to publish " + components.size() + " derived components for componentSetId=" + componentSetId); ComponentSetBo componentSet = getDataObjectService().find(ComponentSetBo.class,componentSetId); if (componentSet == null) { componentSet = new ComponentSetBo(); componentSet.setComponentSetId(componentSetId); } String checksum = calculateChecksum(components); if (!checksum.equals(componentSet.getChecksum())) { LOG.info("Checksums were different, proceeding with update of derived components for componentSetId=" + componentSetId); componentSet.setChecksum(checksum); componentSet.setLastUpdateTimestamp(new Timestamp(System.currentTimeMillis())); if (getComponentSetDao().saveIgnoreLockingFailure(componentSet)) { updateDerivedComponents(componentSetId, components); } } else { LOG.info("Checksums were the same, no derived component update needed for componentSetId=" + componentSetId); } }
ComponentServiceImpl implements ComponentService { @Override @Transactional public void publishDerivedComponents(String componentSetId, List<Component> components) { if (StringUtils.isBlank(componentSetId)) { throw new RiceIllegalArgumentException("componentSetId was a null or blank value"); } components = validateAndNormalizeComponents(componentSetId, components); LOG.info("Requesting to publish " + components.size() + " derived components for componentSetId=" + componentSetId); ComponentSetBo componentSet = getDataObjectService().find(ComponentSetBo.class,componentSetId); if (componentSet == null) { componentSet = new ComponentSetBo(); componentSet.setComponentSetId(componentSetId); } String checksum = calculateChecksum(components); if (!checksum.equals(componentSet.getChecksum())) { LOG.info("Checksums were different, proceeding with update of derived components for componentSetId=" + componentSetId); componentSet.setChecksum(checksum); componentSet.setLastUpdateTimestamp(new Timestamp(System.currentTimeMillis())); if (getComponentSetDao().saveIgnoreLockingFailure(componentSet)) { updateDerivedComponents(componentSetId, components); } } else { LOG.info("Checksums were the same, no derived component update needed for componentSetId=" + componentSetId); } } }
ComponentServiceImpl implements ComponentService { @Override @Transactional public void publishDerivedComponents(String componentSetId, List<Component> components) { if (StringUtils.isBlank(componentSetId)) { throw new RiceIllegalArgumentException("componentSetId was a null or blank value"); } components = validateAndNormalizeComponents(componentSetId, components); LOG.info("Requesting to publish " + components.size() + " derived components for componentSetId=" + componentSetId); ComponentSetBo componentSet = getDataObjectService().find(ComponentSetBo.class,componentSetId); if (componentSet == null) { componentSet = new ComponentSetBo(); componentSet.setComponentSetId(componentSetId); } String checksum = calculateChecksum(components); if (!checksum.equals(componentSet.getChecksum())) { LOG.info("Checksums were different, proceeding with update of derived components for componentSetId=" + componentSetId); componentSet.setChecksum(checksum); componentSet.setLastUpdateTimestamp(new Timestamp(System.currentTimeMillis())); if (getComponentSetDao().saveIgnoreLockingFailure(componentSet)) { updateDerivedComponents(componentSetId, components); } } else { LOG.info("Checksums were the same, no derived component update needed for componentSetId=" + componentSetId); } }  }
ComponentServiceImpl implements ComponentService { @Override @Transactional public void publishDerivedComponents(String componentSetId, List<Component> components) { if (StringUtils.isBlank(componentSetId)) { throw new RiceIllegalArgumentException("componentSetId was a null or blank value"); } components = validateAndNormalizeComponents(componentSetId, components); LOG.info("Requesting to publish " + components.size() + " derived components for componentSetId=" + componentSetId); ComponentSetBo componentSet = getDataObjectService().find(ComponentSetBo.class,componentSetId); if (componentSet == null) { componentSet = new ComponentSetBo(); componentSet.setComponentSetId(componentSetId); } String checksum = calculateChecksum(components); if (!checksum.equals(componentSet.getChecksum())) { LOG.info("Checksums were different, proceeding with update of derived components for componentSetId=" + componentSetId); componentSet.setChecksum(checksum); componentSet.setLastUpdateTimestamp(new Timestamp(System.currentTimeMillis())); if (getComponentSetDao().saveIgnoreLockingFailure(componentSet)) { updateDerivedComponents(componentSetId, components); } } else { LOG.info("Checksums were the same, no derived component update needed for componentSetId=" + componentSetId); } }  @Override Component getComponentByCode(String namespaceCode, String componentCode); @Override List<Component> getAllComponentsByNamespaceCode(String namespaceCode); @Override List<Component> getActiveComponentsByNamespaceCode(String namespaceCode); @Override List<Component> getDerivedComponentSet(String componentSetId); @Override @Transactional void publishDerivedComponents(String componentSetId, List<Component> components); ComponentSetDao getComponentSetDao(); void setComponentSetDao(ComponentSetDao componentSetDao); DataObjectService getDataObjectService(); @Required void setDataObjectService(DataObjectService dataObjectService); }
ComponentServiceImpl implements ComponentService { @Override @Transactional public void publishDerivedComponents(String componentSetId, List<Component> components) { if (StringUtils.isBlank(componentSetId)) { throw new RiceIllegalArgumentException("componentSetId was a null or blank value"); } components = validateAndNormalizeComponents(componentSetId, components); LOG.info("Requesting to publish " + components.size() + " derived components for componentSetId=" + componentSetId); ComponentSetBo componentSet = getDataObjectService().find(ComponentSetBo.class,componentSetId); if (componentSet == null) { componentSet = new ComponentSetBo(); componentSet.setComponentSetId(componentSetId); } String checksum = calculateChecksum(components); if (!checksum.equals(componentSet.getChecksum())) { LOG.info("Checksums were different, proceeding with update of derived components for componentSetId=" + componentSetId); componentSet.setChecksum(checksum); componentSet.setLastUpdateTimestamp(new Timestamp(System.currentTimeMillis())); if (getComponentSetDao().saveIgnoreLockingFailure(componentSet)) { updateDerivedComponents(componentSetId, components); } } else { LOG.info("Checksums were the same, no derived component update needed for componentSetId=" + componentSetId); } }  @Override Component getComponentByCode(String namespaceCode, String componentCode); @Override List<Component> getAllComponentsByNamespaceCode(String namespaceCode); @Override List<Component> getActiveComponentsByNamespaceCode(String namespaceCode); @Override List<Component> getDerivedComponentSet(String componentSetId); @Override @Transactional void publishDerivedComponents(String componentSetId, List<Component> components); ComponentSetDao getComponentSetDao(); void setComponentSetDao(ComponentSetDao componentSetDao); DataObjectService getDataObjectService(); @Required void setDataObjectService(DataObjectService dataObjectService);  }