Skip to content

Commit

Permalink
#1791 - Asset Folder Creator to support non-string cell types (ie. Nu… (
Browse files Browse the repository at this point in the history
#1792)

* #1791 - Asset Folder Creator to support non-string cell types (ie. Numeric)
  • Loading branch information
davidjgonzalez authored and badvision committed Mar 25, 2019
1 parent c28a15b commit 98c095e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com)
- #1762 - Fixed missing code for DAM Assets Copy Publish URL feature.
- #1776 - Fix possibly negative index
- #1780 - Fixed ACS Commons XSS Taglib to work with the support XSSFunctions class.
- #1791 - Fixed Asset Folder Creator to support non-string cell types (ie. Numeric)
- #1800 - Make sure all pending changes are committed in Fast Action Manager when saveInterval isn't 1

## [4.0.0] - 2019-02-20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ private void parseAssetFolderRow(final Row row) {
* @throws IllegalArgumentException
*/
private String parseAssetFolderCell(final Cell cell, final String previousAssetFolderPath) throws IllegalArgumentException {
// #1791 - Cannot read from non-String type fields.
cell.setCellType(Cell.CELL_TYPE_STRING);

final String cellValue = StringUtils.trimToNull(cell.getStringCellValue());

if (StringUtils.isNotBlank(cellValue)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public class AssetFolderCreatorTest {

@Rule
public final SlingContext context = new SlingContext();


@Mock
private ActionManager actionManager;
Expand Down Expand Up @@ -108,7 +107,8 @@ public void parseAssetFolderDefinitions() throws Exception {
assetFolderCreator.parseAssetFolderDefinitions(actionManager);
final int expected = 9 // Col 3
+ 2 // Col 2
+ 2; // Col 1
+ 2 // Col 1
+ 3; // Numeric folders 2019/9/16

assertEquals(expected, assetFolderCreator.assetFolderDefinitions.size());
}
Expand All @@ -123,7 +123,6 @@ public void createAssetFolders() throws Exception {

assertTrue(context.resourceResolver().hasChanges());


assertEquals("Michigan",
context.resourceResolver().getResource("/content/dam/mi/jcr:content").getValueMap().get("jcr:title", String.class));

Expand All @@ -132,6 +131,10 @@ public void createAssetFolders() throws Exception {

assertEquals("West Michigan",
context.resourceResolver().getResource("/content/dam/mi/west-mi/jcr:content").getValueMap().get("jcr:title", String.class));

assertEquals("16",
context.resourceResolver().getResource("/content/dam/2019/9/16/jcr:content").getValueMap().get("jcr:title", String.class));

}

@Test
Expand All @@ -147,7 +150,7 @@ public void updateTitle() throws Exception {

assertTrue(context.resourceResolver().hasChanges());

assertEquals("Massachusettes",
assertEquals("Massachusetts",
context.resourceResolver().getResource("/content/dam/ma/jcr:content").getValueMap().get("jcr:title", String.class));
}
}
Binary file not shown.

0 comments on commit 98c095e

Please sign in to comment.