|
|
@ -70,65 +70,58 @@ public class MobileDeviceManagementConfigTests {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test()
|
|
|
|
@Test(expectedExceptions = JAXBException.class)
|
|
|
|
public void testMandateManagementRepositoryElement() {
|
|
|
|
public void testMandateManagementRepositoryElement() throws JAXBException {
|
|
|
|
File malformedConfig =
|
|
|
|
File malformedConfig =
|
|
|
|
new File(
|
|
|
|
new File(
|
|
|
|
MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_MGT_REPOSITORY);
|
|
|
|
MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_MGT_REPOSITORY);
|
|
|
|
this.validateMalformedConfig(malformedConfig);
|
|
|
|
this.validateMalformedConfig(malformedConfig);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test(expectedExceptions = JAXBException.class)
|
|
|
|
public void testMandateDataSourceConfigurationElement() {
|
|
|
|
public void testMandateDataSourceConfigurationElement() throws JAXBException {
|
|
|
|
File malformedConfig = new File(
|
|
|
|
File malformedConfig = new File(
|
|
|
|
MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_DS_CONFIG);
|
|
|
|
MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_DS_CONFIG);
|
|
|
|
this.validateMalformedConfig(malformedConfig);
|
|
|
|
this.validateMalformedConfig(malformedConfig);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test(expectedExceptions = JAXBException.class)
|
|
|
|
public void testMandateJndiLookupDefinitionElement() {
|
|
|
|
public void testMandateJndiLookupDefinitionElement() throws JAXBException {
|
|
|
|
File malformedConfig = new File(
|
|
|
|
File malformedConfig = new File(
|
|
|
|
MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_JNDI_CONFIG);
|
|
|
|
MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_JNDI_CONFIG);
|
|
|
|
this.validateMalformedConfig(malformedConfig);
|
|
|
|
this.validateMalformedConfig(malformedConfig);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test(expectedExceptions = JAXBException.class)
|
|
|
|
public void testMandateAPIPublisherElement() {
|
|
|
|
public void testMandateAPIPublisherElement() throws JAXBException {
|
|
|
|
File malformedConfig = new File(
|
|
|
|
File malformedConfig = new File(
|
|
|
|
MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_API_PUBLISHER_CONFIG);
|
|
|
|
MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_API_PUBLISHER_CONFIG);
|
|
|
|
this.validateMalformedConfig(malformedConfig);
|
|
|
|
this.validateMalformedConfig(malformedConfig);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test(expectedExceptions = JAXBException.class)
|
|
|
|
public void testMandateAPIsElement() {
|
|
|
|
public void testMandateAPIsElement() throws JAXBException {
|
|
|
|
File malformedConfig = new File(
|
|
|
|
File malformedConfig = new File(
|
|
|
|
MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_APIS_CONFIG);
|
|
|
|
MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_APIS_CONFIG);
|
|
|
|
this.validateMalformedConfig(malformedConfig);
|
|
|
|
this.validateMalformedConfig(malformedConfig);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test(expectedExceptions = JAXBException.class)
|
|
|
|
public void testMandateAPIElement() {
|
|
|
|
public void testMandateAPIElement() throws JAXBException {
|
|
|
|
File malformedConfig = new File(
|
|
|
|
File malformedConfig = new File(
|
|
|
|
MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_API_CONFIG);
|
|
|
|
MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_API_CONFIG);
|
|
|
|
this.validateMalformedConfig(malformedConfig);
|
|
|
|
this.validateMalformedConfig(malformedConfig);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
|
|
|
|
* Validates a given malformed-configuration file.
|
|
|
|
* Validates a given malformed-configuration file.
|
|
|
|
*
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private void validateMalformedConfig(File malformedConfig) {
|
|
|
|
private void validateMalformedConfig(File malformedConfig) throws JAXBException {
|
|
|
|
try {
|
|
|
|
|
|
|
|
JAXBContext ctx = JAXBContext.newInstance(MobileDeviceManagementConfig.class);
|
|
|
|
JAXBContext ctx = JAXBContext.newInstance(MobileDeviceManagementConfig.class);
|
|
|
|
Unmarshaller um = ctx.createUnmarshaller();
|
|
|
|
Unmarshaller um = ctx.createUnmarshaller();
|
|
|
|
um.setSchema(this.getSchema());
|
|
|
|
um.setSchema(this.getSchema());
|
|
|
|
um.unmarshal(malformedConfig);
|
|
|
|
um.unmarshal(malformedConfig);
|
|
|
|
Assert.assertTrue(false);
|
|
|
|
Assert.assertTrue(false);
|
|
|
|
} catch (JAXBException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while unmarsharlling mobile device management config", e);
|
|
|
|
|
|
|
|
Assert.assertTrue(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Schema getSchema() {
|
|
|
|
private Schema getSchema() {
|
|
|
|