Skip to content

Commit 12050b2

Browse files
committed
Rename indexChildren to recursive
Rename the DumAemSession flag from indexChildren to recursive and update usages across the plugin. Adjusted AemNodeNavigator and DumAemSessionService to check/set isRecursive (preserving default true), and updated builders and tests to use the new property. Replaced Mockito doNothing() stubs for dumConnectorContext.addJobItem(...) with when(...).thenReturn(true) to match the method behavior. Also add standard logback-test.xml to test resources in aem-commons, aem-plugin-sample and aem-plugin modules.
1 parent f2ba7d2 commit 12050b2

File tree

10 files changed

+63
-28
lines changed

10 files changed

+63
-28
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<configuration>
3+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
4+
<encoder>
5+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -- %msg%n%nopex</pattern>
6+
</encoder>
7+
</appender>
8+
9+
<root level="INFO">
10+
<appender-ref ref="STDOUT" />
11+
</root>
12+
</configuration>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<configuration>
3+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
4+
<encoder>
5+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -- %msg%n%nopex</pattern>
6+
</encoder>
7+
</appender>
8+
9+
<root level="INFO">
10+
<appender-ref ref="STDOUT" />
11+
</root>
12+
</configuration>

aem/aem-plugin/src/main/java/com/viglet/dumont/connector/plugin/aem/context/DumAemSession.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ public class DumAemSession extends DumConnectorSession {
2020
private DumAemContentMapping contentMapping;
2121
private DumAemEvent event;
2222
private boolean standalone;
23-
private boolean indexChildren;
23+
private boolean recursive;
2424
private List<TurSNAttributeSpec> attributeSpecs;
2525
}

aem/aem-plugin/src/main/java/com/viglet/dumont/connector/plugin/aem/navigator/AemNodeNavigator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public void navigateAndIndex(DumAemSession session, String path, JSONObject infi
8888

8989
processNode(session, aemObject);
9090

91-
if (session.isIndexChildren()) {
91+
if (session.isRecursive()) {
9292
navigateChildren(session, aemObject);
9393
}
9494
}
@@ -161,7 +161,7 @@ private void processChildNode(DumAemSession session, String childPath) {
161161
DumAemObjectGeneric childObject = objectService.getDumAemObjectGeneric(childPath, infinityJson);
162162
processNode(session, childObject);
163163

164-
if (session.isIndexChildren()) {
164+
if (session.isRecursive()) {
165165
navigateChildrenSync(session, childObject);
166166
}
167167
});
@@ -176,7 +176,7 @@ private Mono<Void> processChildNodeReactive(DumAemSession session, String childP
176176
DumAemObjectGeneric childObject = objectService.getDumAemObjectGeneric(childPath, infinityJson);
177177
processNode(session, childObject);
178178

179-
if (session.isIndexChildren()) {
179+
if (session.isRecursive()) {
180180
return navigateChildrenReactive(session, childObject);
181181
}
182182
return Mono.empty();

aem/aem-plugin/src/main/java/com/viglet/dumont/connector/plugin/aem/service/DumAemSessionService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public DumAemSession getDumAemSession(DumAemSource dumAemSource,
5252
.map(DumAemPathList::getEvent)
5353
.orElse(DumAemEvent.NONE);
5454

55-
boolean indexChildren = Optional.ofNullable(dumAemPathList)
55+
boolean recursive = Optional.ofNullable(dumAemPathList)
5656
.map(DumAemPathList::getRecursive)
5757
.orElse(true);
5858

@@ -61,7 +61,7 @@ public DumAemSession getDumAemSession(DumAemSource dumAemSource,
6161
.configuration(dumAemConfiguration)
6262
.event(event)
6363
.standalone(standalone)
64-
.indexChildren(indexChildren)
64+
.recursive(recursive)
6565
.source(session.getSource())
6666
.transactionId(session.getTransactionId())
6767
.sites(session.getSites())

aem/aem-plugin/src/test/java/com/viglet/dumont/connector/plugin/aem/context/DumAemSessionTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void shouldBuildSessionWithAllFields() {
7070
.contentMapping(contentMapping)
7171
.event(event)
7272
.standalone(true)
73-
.indexChildren(true)
73+
.recursive(true)
7474
.attributeSpecs(attributeSpecs)
7575
.build();
7676

@@ -79,7 +79,7 @@ void shouldBuildSessionWithAllFields() {
7979
assertNotNull(session.getContentMapping());
8080
assertNotNull(session.getEvent());
8181
assertTrue(session.isStandalone());
82-
assertTrue(session.isIndexChildren());
82+
assertTrue(session.isRecursive());
8383
assertEquals(1, session.getAttributeSpecs().size());
8484
}
8585

@@ -93,7 +93,7 @@ void shouldBuildSessionWithMinimalFields() {
9393
assertNull(session.getContentMapping());
9494
assertNull(session.getEvent());
9595
assertFalse(session.isStandalone());
96-
assertFalse(session.isIndexChildren());
96+
assertFalse(session.isRecursive());
9797
assertNull(session.getAttributeSpecs());
9898
}
9999
}
@@ -110,7 +110,7 @@ void shouldCreateSessionWithDefaultValues() {
110110
assertNull(session.getConfiguration());
111111
assertNull(session.getModel());
112112
assertFalse(session.isStandalone());
113-
assertFalse(session.isIndexChildren());
113+
assertFalse(session.isRecursive());
114114
}
115115
}
116116

@@ -133,7 +133,7 @@ void shouldCreateSessionWithAllArguments() {
133133
.contentMapping(contentMapping)
134134
.event(event)
135135
.standalone(true)
136-
.indexChildren(true)
136+
.recursive(true)
137137
.attributeSpecs(attributeSpecs)
138138
.build();
139139

@@ -142,7 +142,7 @@ void shouldCreateSessionWithAllArguments() {
142142
assertEquals(contentMapping, session.getContentMapping());
143143
assertEquals(event, session.getEvent());
144144
assertTrue(session.isStandalone());
145-
assertTrue(session.isIndexChildren());
145+
assertTrue(session.isRecursive());
146146
assertEquals(attributeSpecs, session.getAttributeSpecs());
147147
}
148148
}

aem/aem-plugin/src/test/java/com/viglet/dumont/connector/plugin/aem/navigator/AemNodeNavigatorTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ void shouldProcessNodeWhenTypeMatchesContentType() {
160160
}
161161

162162
@Test
163-
@DisplayName("Should navigate children when indexChildren is true")
164-
void shouldNavigateChildrenWhenIndexChildrenIsTrue() {
163+
@DisplayName("Should navigate children when recursive is true")
164+
void shouldNavigateChildrenWhenRecursiveIsTrue() {
165165
// Given
166166
DumAemSession session = createMockSession(true);
167167
String path = "/content/test";
@@ -179,8 +179,8 @@ void shouldNavigateChildrenWhenIndexChildrenIsTrue() {
179179
}
180180

181181
@Test
182-
@DisplayName("Should not navigate children when indexChildren is false")
183-
void shouldNotNavigateChildrenWhenIndexChildrenIsFalse() {
182+
@DisplayName("Should not navigate children when recursive is false")
183+
void shouldNotNavigateChildrenWhenRecursiveIsFalse() {
184184
// Given
185185
DumAemSession session = createMockSession(false);
186186
String path = "/content/test";
@@ -225,15 +225,15 @@ void shouldUseReactiveNavigationWhenEnabled() {
225225
}
226226
}
227227

228-
private DumAemSession createMockSession(boolean indexChildren) {
228+
private DumAemSession createMockSession(boolean recursive) {
229229
DumAemConfiguration config = mock(DumAemConfiguration.class);
230230
lenient().when(config.getContentType()).thenReturn("cq:Page");
231231
lenient().when(config.getSubType()).thenReturn(null);
232232

233233
return DumAemSession.builder()
234234
.configuration(config)
235235
.event(DumAemEvent.NONE)
236-
.indexChildren(indexChildren)
236+
.recursive(recursive)
237237
.standalone(true)
238238
.providerName("AEM")
239239
.build();

aem/aem-plugin/src/test/java/com/viglet/dumont/connector/plugin/aem/service/DumAemJobServiceTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import static org.junit.jupiter.api.Assertions.assertNotNull;
2222
import static org.mockito.ArgumentMatchers.any;
2323
import static org.mockito.ArgumentMatchers.anyString;
24-
import static org.mockito.Mockito.doNothing;
2524
import static org.mockito.Mockito.lenient;
2625
import static org.mockito.Mockito.mock;
2726
import static org.mockito.Mockito.times;
@@ -197,7 +196,7 @@ void shouldIndexForAuthorEnvironmentWhenConfigured() {
197196
.thenReturn(new DumAemTargetAttrValueMap());
198197
when(dumAemContentDefinitionService.getDeltaDate(any(), any(), any()))
199198
.thenReturn(new Date());
200-
doNothing().when(dumConnectorContext).addJobItem(any());
199+
when(dumConnectorContext.addJobItem(any())).thenReturn(true);
201200

202201
// When
203202
service.indexObject(session, aemObjectGeneric);
@@ -217,7 +216,7 @@ void shouldIndexForPublishEnvironmentWhenConfiguredAndDelivered() {
217216
.thenReturn(new DumAemTargetAttrValueMap());
218217
lenient().when(dumAemContentDefinitionService.getDeltaDate(any(), any(), any()))
219218
.thenReturn(new Date());
220-
lenient().doNothing().when(dumConnectorContext).addJobItem(any());
219+
lenient().when(dumConnectorContext.addJobItem(any())).thenReturn(true);
221220

222221
// When
223222
service.indexObject(session, aemObjectGeneric);

aem/aem-plugin/src/test/java/com/viglet/dumont/connector/plugin/aem/service/DumAemSessionServiceTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ void shouldSetEventFromPathList() {
125125
}
126126

127127
@Test
128-
@DisplayName("Should set indexChildren from path list recursive flag")
129-
void shouldSetIndexChildrenFromPathListRecursiveFlag() {
128+
@DisplayName("Should set recursive from path list recursive flag")
129+
void shouldSetRecursiveFromPathListRecursiveFlag() {
130130
// Given
131131
DumAemSource source = createDumAemSource();
132132
DumAemPathList pathList = createDumAemPathList(DumAemEvent.NONE, false);
@@ -138,7 +138,7 @@ void shouldSetIndexChildrenFromPathListRecursiveFlag() {
138138

139139
// Then
140140
assertNotNull(result);
141-
assertFalse(result.isIndexChildren());
141+
assertFalse(result.isRecursive());
142142
}
143143

144144
@Test
@@ -158,8 +158,8 @@ void shouldDefaultToNoneEventWhenPathListIsNull() {
158158
}
159159

160160
@Test
161-
@DisplayName("Should default to true for indexChildren when path list is null")
162-
void shouldDefaultToTrueForIndexChildrenWhenPathListIsNull() {
161+
@DisplayName("Should default to true for recursive when path list is null")
162+
void shouldDefaultToTrueForRecursiveWhenPathListIsNull() {
163163
// Given
164164
DumAemSource source = createDumAemSource();
165165

@@ -170,7 +170,7 @@ void shouldDefaultToTrueForIndexChildrenWhenPathListIsNull() {
170170

171171
// Then
172172
assertNotNull(result);
173-
assertTrue(result.isIndexChildren());
173+
assertTrue(result.isRecursive());
174174
}
175175

176176
@Test
@@ -281,7 +281,7 @@ void shouldUseDefaultValuesWhenNoPathListProvided() {
281281
// Then
282282
assertNotNull(result);
283283
assertEquals(DumAemEvent.NONE, result.getEvent());
284-
assertTrue(result.isIndexChildren());
284+
assertTrue(result.isRecursive());
285285
assertFalse(result.isStandalone());
286286
}
287287
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<configuration>
3+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
4+
<encoder>
5+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -- %msg%n%nopex</pattern>
6+
</encoder>
7+
</appender>
8+
9+
<root level="INFO">
10+
<appender-ref ref="STDOUT" />
11+
</root>
12+
</configuration>

0 commit comments

Comments
 (0)