+ static SchemaContext SCHEMA_CONTEXT;
+ static DatastoreContextIntrospectorFactory INTROSPECTOR_FACTORY;
+
+ static {
+ final ModuleInfoBackedContext moduleContext = ModuleInfoBackedContext.create();
+ try {
+ moduleContext.addModuleInfos(Arrays.asList(
+ BindingReflections.getModuleInfo(DataStorePropertiesContainer.class)));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ SCHEMA_CONTEXT = moduleContext.tryToCreateSchemaContext().get();
+
+ DOMSchemaService mockSchemaService = mock(DOMSchemaService.class);
+ doReturn(SCHEMA_CONTEXT).when(mockSchemaService).getGlobalContext();
+ INTROSPECTOR_FACTORY = new DatastoreContextIntrospectorFactory(mockSchemaService,
+ GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy());
+ }
+
+ @Test
+ public void testYangDefaults() {
+ final DatastoreContextIntrospector introspector = INTROSPECTOR_FACTORY.newInstance(
+ DatastoreContext.newBuilder().shardBatchedModificationCount(2)
+ .transactionDebugContextEnabled(true).build());
+ DatastoreContext context = introspector.getContext();
+
+ assertEquals(1000, context.getShardBatchedModificationCount());
+ assertFalse(context.isTransactionDebugContextEnabled());
+ }
+