use of org.apache.sling.api.wrappers.ModifiableValueMapDecorator in project acs-aem-commons by Adobe-Consulting-Services.
the class EnsureOakIndexJobHandlerTest method getEnsureOakDefinition.
Resource getEnsureOakDefinition(Map<String, Object> properties) {
Resource r = mock(Resource.class);
ValueMap vm = new MockValueMap(r, properties);
when(r.getValueMap()).thenReturn(vm);
when(r.adaptTo(ModifiableValueMap.class)).thenReturn(new ModifiableValueMapDecorator(properties));
when(r.getName()).thenReturn(INDEX_NAME);
when(r.getPath()).thenReturn(DEFINITION_PATH);
when(r.listChildren()).thenReturn(IteratorUtils.EMPTY_LIST_ITERATOR);
return r;
}
use of org.apache.sling.api.wrappers.ModifiableValueMapDecorator in project acs-aem-commons by Adobe-Consulting-Services.
the class EnsureOakIndexJobHandlerTest method getOakDefinition.
Resource getOakDefinition(Map<String, Object> properties) {
Resource r = mock(Resource.class);
ValueMap vm = new MockValueMap(r, properties);
when(r.adaptTo(ModifiableValueMap.class)).thenReturn(new ModifiableValueMapDecorator(properties));
when(r.getValueMap()).thenReturn(vm);
when(r.getName()).thenReturn(INDEX_NAME);
when(r.getPath()).thenReturn(OAK_INDEX + "/" + INDEX_NAME);
when(r.listChildren()).thenReturn(IteratorUtils.EMPTY_LIST_ITERATOR);
return r;
}
use of org.apache.sling.api.wrappers.ModifiableValueMapDecorator in project acs-aem-commons by Adobe-Consulting-Services.
the class ProcessInstanceImpl method init.
@Override
public void init(ResourceResolver resourceResolver, Map<String, Object> parameterMap) throws DeserializeException, RepositoryException {
ValueMap inputs = new ModifiableValueMapDecorator(parameterMap);
infoBean.setRequestInputs(inputs);
definition.parseInputs(inputs);
}
use of org.apache.sling.api.wrappers.ModifiableValueMapDecorator in project acs-aem-commons by Adobe-Consulting-Services.
the class ChildrenAsPropertyResourceTest method setUp.
@Before
public void setUp() throws Exception {
valueMap = new ModifiableValueMapDecorator(new HashMap<String, Object>());
when(resource.getPath()).thenReturn("/content/test");
when(resource.getValueMap()).thenReturn(valueMap);
when(resource.adaptTo(ValueMap.class)).thenReturn(valueMap);
when(resource.adaptTo(ModifiableValueMap.class)).thenReturn(valueMap);
when(resource.getResourceResolver()).thenReturn(resourceResolver);
entry1.put("name", "dog");
entry1.put("sound", "woof");
entry1.put("jcr:primaryType", "nt:unstructured");
entry2.put("name", "cat");
entry2.put("sound", "meow");
entry1.put("jcr:primaryType", "nt:unstructured");
entry3.put("name", "fish");
entry3.put("sound", "...");
entry1.put("jcr:primaryType", "nt:unstructured");
entry100.put("name", "dog");
entry100.put("sound", "woof");
entry100.put("double", 20.002D);
entry100.put("long", 2000L);
entry100.put("bigdecimal", "10000.000001");
entry100.put("bigdecimal2", "20000.000002");
entry100.put("integer", 100);
entry100.put("integerAsLong", 100L);
entry100.put("integerAsDouble", 100D);
Calendar cal = Calendar.getInstance();
cal.set(2001, 1, 1, 1, 1, 1);
entry100.put("date", cal.getTime());
entry100.put("calendar", cal);
entry100.put("boolean", true);
entry100.put("booleanAsString", "true");
entry100.put("strArray", new String[] { "one", "two" });
entry1.put("jcr:primaryType", "nt:unstructured");
unsortedJSON.put("entry-2", new JSONObject(entry2));
unsortedJSON.put("entry-1", new JSONObject(entry1));
unsortedJSON.put("entry-3", new JSONObject(entry3));
sortedJSON.put("entry-1", new JSONObject(entry1));
sortedJSON.put("entry-2", new JSONObject(entry2));
sortedJSON.put("entry-3", new JSONObject(entry3));
}
use of org.apache.sling.api.wrappers.ModifiableValueMapDecorator in project acs-aem-commons by Adobe-Consulting-Services.
the class AnnotatedFieldDeserializerTest method testBooleanFalseByDefault.
/**
* Check if booleans are assumed false if missing.
*
* @throws java.lang.Exception
*/
@Test
public void testBooleanFalseByDefault() throws Exception {
System.out.println("processInput");
PrimitivesTest target = new PrimitivesTest();
Map<String, Object> params = new HashMap<>();
params.put("intValue", "123");
params.put("doubleValue", numberFormat.format(123.456));
params.put("floatValue", numberFormat.format(234.567f));
params.put("longValue", "1234567890");
target.booleanValue = true;
AnnotatedFieldDeserializer.deserializeFormFields(target, new ModifiableValueMapDecorator(params));
assertEquals(123, target.intValue);
assertEquals(123.456D, target.doubleValue, 0);
assertEquals(234.567F, target.floatValue, 0);
assertEquals(1234567890L, target.longValue);
assertEquals(false, target.booleanValue);
}
Aggregations