use of org.xml.sax.InputSource in project liquibase by liquibase.
the class LiquibaseEntityResolverTest method whenSystemIdIsNotXsdLoadResourceFromBasepathWithResourceAccessor.
@Test
public void whenSystemIdIsNotXsdLoadResourceFromBasepathWithResourceAccessor() throws IOException, SAXException {
PowerMockito.when(StreamUtil.singleInputStream(PATH_AND_SYSTEM_ID, resourceAccessor)).thenReturn(inputStream);
InputSource result = liquibaseEntityResolver.resolveEntity(NAME, PUBLIC_ID, BASE_URI, FILE_SYSTEM_ID);
assertThat(result.getByteStream()).isEqualTo(inputStream);
}
use of org.xml.sax.InputSource in project liquibase by liquibase.
the class LiquibaseEntityResolverTest method shouldReturnSchemaResolverResultWhenSystemIdIsValidXsd.
@Test
public void shouldReturnSchemaResolverResultWhenSystemIdIsValidXsd() throws IOException, SAXException {
InputSource result = liquibaseEntityResolver.resolveEntity(NAME, PUBLIC_ID, BASE_URI, SYSTEM_ID);
assertThat(result).isSameAs(inputSource);
}
use of org.xml.sax.InputSource in project liquibase by liquibase.
the class LiquibaseEntityResolverTest method whenSystemIdIsNotXsdAndResourceCouldNotBeLoadedFromResourceAccessorReturnNull.
@Test
public void whenSystemIdIsNotXsdAndResourceCouldNotBeLoadedFromResourceAccessorReturnNull() throws IOException, SAXException {
PowerMockito.when(StreamUtil.singleInputStream(PATH_AND_SYSTEM_ID, resourceAccessor)).thenReturn(null);
InputSource result = liquibaseEntityResolver.resolveEntity(NAME, PUBLIC_ID, BASE_URI, FILE_SYSTEM_ID);
assertThat(result).isEqualTo(null);
}
use of org.xml.sax.InputSource in project liquibase by liquibase.
the class LiquibaseEntityResolverTest method shouldReturnSchemaResolverResultWhenSystemIdIsValidXsdAndSerializerIsNotNull.
@Test
public void shouldReturnSchemaResolverResultWhenSystemIdIsValidXsdAndSerializerIsNotNull() throws IOException, SAXException {
liquibaseEntityResolver = new LiquibaseEntityResolver(serializer);
liquibaseEntityResolver.useResoureAccessor(resourceAccessor, BASE_PATH);
InputSource result = liquibaseEntityResolver.resolveEntity(NAME, PUBLIC_ID, BASE_URI, SYSTEM_ID);
assertThat(result).isSameAs(inputSource);
}
use of org.xml.sax.InputSource in project liquibase by liquibase.
the class LiquibaseSchemaResolverTest method shouldReturnNullWhenXsdFileFoundIsNull.
@Test
public void shouldReturnNullWhenXsdFileFoundIsNull() {
when(nameSpaceDetialsForParser.getLocalPath(SYSTEM_ID)).thenReturn(null);
InputSource inputSource = liquibaseSchemaResolver.resolve(liquibaseParser);
assertThat(inputSource).isNull();
}
Aggregations