CoreConfigurationDto extends AbstractConfigDto<CoreConfigurationType> { @SuppressWarnings("unchecked") static CoreConfigurationDto readFrom(Reader reader) throws JAXBException, InvalidConfigurationException { JAXBContext context = JAXBContext.newInstance(ObjectFactory.class); Object po = context.createUnmarshaller().unmarshal(reader); CoreConfigurationType parsed = null; if (po instanceof CoreConfigurationType) { parsed = (CoreConfigurationType)po; } else { parsed = ((JAXBElement<CoreConfigurationType>)po).getValue(); } validateConfig(parsed); return new CoreConfigurationDto(parsed); } CoreConfigurationDto(CoreConfigurationType jaxBConfig); @Override CoreConfigurationType getJaxbConfig(); String getServerUrl(); void setServerUrl(String serverUrl); Map<String, ServiceProviderDto> getServiceProvider(); boolean isSessionManagerUsesDatabase(); void setSessionManagerUsesDatabase(boolean value); int getSessionMaxPendingRequests(); void setSessionMaxPendingRequests(int value); TimerConfigurationType getTimerConfiguration(); Set<String> getAllowedDocumentTypes();  }
@Test void validateConfigThrowsExceptionWhenDuplicatedEntityPresent() throws Exception { InputStream resourceAsStream = CoreConfigurationDtoTest.class.getResourceAsStream("/POSeIDAS-duplicated-SP.xml"); byte[] bytes = ByteStreams.toByteArray(resourceAsStream); Reader reader = CharSource.wrap(new String(bytes)).openStream(); Assertions.assertThrows(InvalidConfigurationException.class, () -> CoreConfigurationDto.readFrom(reader)); }