use of com.thoughtworks.go.util.XsdValidationException in project gocd by gocd.
the class SCMConfigXmlLoaderTest method shouldThrowXsdValidationWhenSCMNameIsEmpty.
@Test
public void shouldThrowXsdValidationWhenSCMNameIsEmpty() throws Exception {
String xml = "<cruise schemaVersion='" + GoConstants.CONFIG_SCHEMA_VERSION + "'><scms>\n" + SCM_WITH_EMPTY_NAME + " </scms></cruise>";
try {
xmlLoader.loadConfigHolder(xml);
fail("should have thrown XsdValidationException");
} catch (XsdValidationException e) {
assertThat(e.getMessage(), is("Name is invalid. \"\" should conform to the pattern - [a-zA-Z0-9_\\-]{1}[a-zA-Z0-9_\\-.]*"));
}
}
use of com.thoughtworks.go.util.XsdValidationException in project gocd by gocd.
the class SCMConfigXmlLoaderTest method shouldThrowXsdValidationWhenSCMIdIsEmpty.
@Test
public void shouldThrowXsdValidationWhenSCMIdIsEmpty() throws Exception {
String xml = "<cruise schemaVersion='" + GoConstants.CONFIG_SCHEMA_VERSION + "'><scms>\n" + SCM_WITH_EMPTY_ID + " </scms></cruise>";
try {
xmlLoader.loadConfigHolder(xml);
fail("should have thrown XsdValidationException");
} catch (XsdValidationException e) {
assertThat(e.getMessage(), is("Scm id is invalid. \"\" should conform to the pattern - [a-zA-Z0-9_\\-]{1}[a-zA-Z0-9_\\-.]*"));
}
}
use of com.thoughtworks.go.util.XsdValidationException in project gocd by gocd.
the class SCMConfigXmlLoaderTest method shouldThrowXsdValidationWhenSCMIdIsInvalid.
@Test
public void shouldThrowXsdValidationWhenSCMIdIsInvalid() throws Exception {
String xml = "<cruise schemaVersion='" + GoConstants.CONFIG_SCHEMA_VERSION + "'><scms>\n" + SCM_WITH_INVALID_ID + " </scms></cruise>";
try {
xmlLoader.loadConfigHolder(xml);
fail("should have thrown XsdValidationException");
} catch (XsdValidationException e) {
assertThat(e.getMessage(), is("Scm id is invalid. \"id with space\" should conform to the pattern - [a-zA-Z0-9_\\-]{1}[a-zA-Z0-9_\\-.]*"));
}
}
use of com.thoughtworks.go.util.XsdValidationException in project gocd by gocd.
the class SCMConfigXmlLoaderTest method shouldThrowXsdValidationWhenSCMNameIsInvalid.
@Test
public void shouldThrowXsdValidationWhenSCMNameIsInvalid() throws Exception {
String xml = "<cruise schemaVersion='" + GoConstants.CONFIG_SCHEMA_VERSION + "'><scms>\n" + SCM_WITH_INVALID_NAME + " </scms></cruise>";
try {
xmlLoader.loadConfigHolder(xml);
fail("should have thrown XsdValidationException");
} catch (XsdValidationException e) {
assertThat(e.getMessage(), is("Name is invalid. \"name with space\" should conform to the pattern - [a-zA-Z0-9_\\-]{1}[a-zA-Z0-9_\\-.]*"));
}
}
use of com.thoughtworks.go.util.XsdValidationException in project gocd by gocd.
the class SCMConfigXmlLoaderTest method shouldThrowXsdValidationWhenSCMIdsAreDuplicate.
@Test
public void shouldThrowXsdValidationWhenSCMIdsAreDuplicate() throws Exception {
String xml = "<cruise schemaVersion='" + GoConstants.CONFIG_SCHEMA_VERSION + "'><scms>\n" + VALID_SCM + VALID_SCM + " </scms></cruise>";
try {
xmlLoader.loadConfigHolder(xml);
fail("should have thrown XsdValidationException");
} catch (XsdValidationException e) {
assertThat(e.getMessage(), anyOf(is("Duplicate unique value [scm-id] declared for identity constraint of element \"cruise\"."), is("Duplicate unique value [scm-id] declared for identity constraint \"uniqueSCMId\" of element \"cruise\".")));
}
}
Aggregations