import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
+import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ExecutionException;
-import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.repo.api.MissingSchemaSourceException;
assertEquals(id2, source.checkedGet().getIdentifier());
}
- private SourceIdentifier loadAndRegisterSource(final SharedSchemaRepository sharedSchemaRepository, final String resourceName) throws Exception {
+ private static SourceIdentifier loadAndRegisterSource(final SharedSchemaRepository sharedSchemaRepository, final String resourceName) throws Exception {
final SettableSchemaProvider<ASTSchemaSource> sourceProvider = getImmediateYangSourceProviderFromResource(resourceName);
sourceProvider.setResult();
final SourceIdentifier idNoRevision = sourceProvider.getId();
}
};
assertThat(Collections2.transform(listener.registeredSources, potSourceToSID),
- both(hasItem(new SourceIdentifier("test", Optional.<String>absent())))
+ both(hasItem(new SourceIdentifier("test", Optional.absent())))
.and(hasItem(new SourceIdentifier("test", Optional.of("2012-12-12"))))
.and(hasItem(new SourceIdentifier("test", Optional.of("2013-12-12"))))
.and(hasItem(new SourceIdentifier("module", Optional.of("2010-12-12"))))
sharedSchemaRepository.registerSchemaSource(new SchemaSourceProvider<YangTextSchemaSource>() {
@Override
public CheckedFuture<YangTextSchemaSource, SchemaSourceException> getSource(final SourceIdentifier sourceIdentifier) {
- return Futures.<YangTextSchemaSource, SchemaSourceException>immediateCheckedFuture(new YangTextSchemaSource(runningId) {
+ return Futures.immediateCheckedFuture(new YangTextSchemaSource(runningId) {
@Override
protected MoreObjects.ToStringHelper addToStringAttributes(final MoreObjects.ToStringHelper toStringHelper) {
return toStringHelper;
@Override
public InputStream openStream() throws IOException {
- return IOUtils.toInputStream("running");
+ return new ByteArrayInputStream("running".getBytes(Charsets.UTF_8));
}
});
}
fail("Creation of schema context should fail from non-regular sources");
}
- private void assertSchemaContext(final SchemaContext schemaContext, final int moduleSize) {
+ private static void assertSchemaContext(final SchemaContext schemaContext, final int moduleSize) {
assertNotNull(schemaContext);
assertEquals(moduleSize, schemaContext.getModules().size());
}