use of org.motechproject.mds.dto.AdvancedSettingsDto in project motech by motech.
the class EntityProcessorTest method shouldNotOverrideHistorySettingsIfModifiedByUser.
@Test
public void shouldNotOverrideHistorySettingsIfModifiedByUser() {
EntityDto existingEntity = new EntityDto(1L, Sample.class.getName());
TrackingDto existingTracking = new TrackingDto();
existingTracking.setModifiedByUser(true);
AdvancedSettingsDto existingAdvancedSettings = new AdvancedSettingsDto();
existingAdvancedSettings.setTracking(existingTracking);
when(schemaHolder.getEntityByClassName(Sample.class.getName())).thenReturn(existingEntity);
when(schemaHolder.getAdvancedSettings(Sample.class.getName())).thenReturn(existingAdvancedSettings);
when(crudEventsProcessor.getProcessingResult()).thenReturn(existingTracking);
processor.process(Sample.class);
EntityDto entity = processor.getProcessingResult().get(0).getEntityProcessingResult();
TrackingDto tracking = processor.getProcessingResult().get(0).getTrackingProcessingResult();
assertFalse(entity.isRecordHistory());
assertFalse(tracking.isRecordHistory());
}
use of org.motechproject.mds.dto.AdvancedSettingsDto in project motech by motech.
the class LookupProcessorTest method shouldNotUpdateRestExposedValueForLookupsThatHaveThatModifiedByUser.
@Test
public void shouldNotUpdateRestExposedValueForLookupsThatHaveThatModifiedByUser() throws Exception {
when(paranamer.lookupParameterNames(getTestMethodExposedViaRest())).thenReturn(argNames);
AdvancedSettingsDto advanced = mock(AdvancedSettingsDto.class);
RestOptionsDto restOptions = mock(RestOptionsDto.class);
when(schemaHolder.getAdvancedSettings(TEST_CLASS_NAME)).thenReturn(advanced);
when(advanced.getRestOptions()).thenReturn(restOptions);
when(restOptions.isModifiedByUser()).thenReturn(true);
EntityProcessorOutput eop = mockEntityProcessorOutput(new EntityDto(TestClass.class.getName()), Arrays.asList(new FieldDto("aaa", "bbb", TypeDto.STRING)));
lookupProcessor.setEntityProcessingResult(Arrays.asList(eop));
Method method = getTestMethodExposedViaRest();
LookupDto dto = new LookupDto("Test Method Exposed Via Rest", true, false, lookupFieldDtos(argNames), true, "testMethodExposedViaRest", asList(argNames), true);
lookupProcessor.process(method);
Map<String, List<LookupDto>> elements = lookupProcessor.getProcessingResult();
assertTrue(elements.containsKey(TEST_CLASS_NAME));
List<LookupDto> list = elements.get(TEST_CLASS_NAME);
assertEquals(1, list.size());
assertEquals(dto, list.get(0));
}
Aggregations