import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableList;
-import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.ListenableFuture;
+import java.util.concurrent.ExecutionException;
import org.junit.Test;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.SchemaNode;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
import org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactory;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaResolutionException;
import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceFilter;
import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
setAndRegister(sharedSchemaRepository, bar1);
setAndRegister(sharedSchemaRepository, bar2);
- final SchemaContextFactory fact = sharedSchemaRepository
- .createSchemaContextFactory(SchemaSourceFilter.ALWAYS_ACCEPT);
-
- final CheckedFuture<SchemaContext, SchemaResolutionException> schemaContextFuture = fact
- .createSchemaContext(ImmutableList.of(foo.getId(), bar1.getId(), bar2.getId()));
+ final SchemaContextFactory fact = sharedSchemaRepository.createSchemaContextFactory(
+ SchemaSourceFilter.ALWAYS_ACCEPT);
+ final ListenableFuture<SchemaContext> schemaContextFuture = fact.createSchemaContext(
+ ImmutableList.of(foo.getId(), bar1.getId(), bar2.getId()));
assertTrue(schemaContextFuture.isDone());
try {
- schemaContextFuture.checkedGet();
+ schemaContextFuture.get();
fail("Test should fail due to invalid imports of yang source.");
- } catch (final SchemaResolutionException e) {
- assertTrue(e.getCause().getMessage().startsWith("Module:bar imported twice with different revisions"));
+ } catch (final ExecutionException e) {
+ assertTrue(e.getCause().getMessage().startsWith(
+ "Module:bar imported twice with different revisions"));
}
}