Example #1
0
        private void AssertFullyQualifiedName(Type clazz)
        {
            var reflectClass = Platform4.ReflectorForType(clazz).ForClass(clazz);

            Assert.AreEqual(ReflectPlatform.FullyQualifiedName(clazz), reflectClass.GetName()
                            );
        }
 private void PrepareCommon(ICommonConfiguration commonConfig, IList classesNotFound
                            )
 {
     commonConfig.ReflectWith(Platform4.ReflectorForType(typeof(MissingClassDiagnosticsTestCase.Pilot
                                                                )));
     PrepareDiagnostic(commonConfig, classesNotFound);
 }
Example #3
0
 private static IEmbeddedConfiguration Db4oConfig(IEmbeddedConfiguration db4oConfig
                                                  )
 {
     db4oConfig.Common.ReflectWith(Platform4.ReflectorForType(typeof(Data
                                                                     )));
     return(db4oConfig);
 }
        private IEmbeddedConfiguration Config()
        {
            IEmbeddedConfiguration config = NewConfiguration();

            config.Common.ReflectWith(Platform4.ReflectorForType(typeof(RepeatDeleteReaddTestCase.ItemA
                                                                        )));
            return(config);
        }
Example #5
0
        private IEmbeddedConfiguration Config()
        {
            var config = NewConfiguration();

            config.Common.ReflectWith(Platform4.ReflectorForType(typeof(ItemA
                                                                        )));
            return(config);
        }
Example #6
0
        private IEmbeddedConfiguration Config()
        {
            IEmbeddedConfiguration config = NewConfiguration();

            config.Common.ObjectClass(typeof(BackupStressItem)).ObjectField("_iteration").Indexed
                (true);
            config.Common.ReflectWith(Platform4.ReflectorForType(typeof(BackupStressItem)));
            return(config);
        }
        private IEmbeddedConfiguration Config(MemoryStorage storage)
        {
            var config = Db4oEmbedded.NewConfiguration();

            config.File.Storage = storage;
            config.Common.ReflectWith(Platform4.ReflectorForType(typeof(Item
                                                                        )));
            return(config);
        }
        private IEmbeddedConfiguration Config(int blockSize)
        {
            IEmbeddedConfiguration config = NewConfiguration();

            config.File.BlockSize = blockSize;
            config.Common.ReflectWith(Platform4.ReflectorForType(typeof(BlockSizeDefragTestCase.ItemA
                                                                        )));
            return(config);
        }
        private IConfiguration NewConfiguration(bool allowVersionUpdates)
        {
            IConfiguration config = Db4oFactory.NewConfiguration();

            config.ReflectWith(Platform4.ReflectorForType(typeof(OldFormatExceptionTestCase))
                               );
            config.AllowVersionUpdates(allowVersionUpdates);
            return(config);
        }
Example #10
0
            private IEmbeddedConfiguration Config(IStorage storage)
            {
                IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();

                config.Common.ReflectWith(Platform4.ReflectorForType(typeof(DefragInMemoryTestSuite.DefragInMemoryTestUnit.Item
                                                                            )));
                config.File.Storage = storage;
                return(config);
            }
Example #11
0
        public virtual void TestExceptionIsPropagated()
        {
            var reflector = Platform4.ReflectorForType(typeof(Item
                                                              ));
            var field = reflector.ForClass(typeof(Item
                                                  )).GetDeclaredField("_name");

            Assert.Expect(typeof(Db4oException), typeof(ArgumentException), new _ICodeBlock_18
                              (field));
        }
 private IEmbeddedObjectContainer OpenContainer(IEmbeddedConfiguration config)
 {
     if (config == null)
     {
         config = NewConfiguration();
     }
     config.Common.ReflectWith(Platform4.ReflectorForType(typeof(CommitTimestampDefragmentTestCase.Item
                                                                 )));
     return(config == null?Db4oEmbedded.OpenFile(SourceFile()) : Db4oEmbedded.OpenFile
                    (config, SourceFile()));
 }
        /// <summary>todo: Move the GenericClass creation into a utility/factory class.</summary>
        /// <remarks>todo: Move the GenericClass creation into a utility/factory class.</remarks>
        /// <returns></returns>
        public virtual GenericClass InitGenericClass()
        {
            GenericReflector reflector = new GenericReflector(null, Platform4.ReflectorForType
                                                                  (typeof(GenericObjectsTest)));
            GenericClass _objectIClass = (GenericClass)reflector.ForClass(typeof(object));
            GenericClass result        = new GenericClass(reflector, null, PersonClassname, _objectIClass
                                                          );

            result.InitFields(Fields(result, reflector));
            return(result);
        }
		private IEmbeddedConfiguration Config(bool registerTranslator)
		{
			IEmbeddedConfiguration config = NewConfiguration();
			config.Common.ReflectWith(Platform4.ReflectorForType(typeof(TranslatedDefragTestCase.Translated
				)));
			if (registerTranslator)
			{
				config.Common.ObjectClass(typeof(TranslatedDefragTestCase.Translated)).Translate(
					new TranslatedDefragTestCase.TranslatedTranslator());
			}
			return config;
		}
Example #15
0
        private IEmbeddedConfiguration GetConfiguration()
        {
            IEmbeddedConfiguration config = NewConfiguration();

            config.Common.ActivationDepth  = int.MaxValue;
            config.Common.CallConstructors = true;
            config.File.Storage            = new DefragEncryptedFileTestCase.MockStorage(config.File.Storage
                                                                                         , "db4o");
            config.Common.ReflectWith(Platform4.ReflectorForType(typeof(DefragEncryptedFileTestCase.Item
                                                                        )));
            Db4oFactory.Configure().Password("encrypted");
            Db4oFactory.Configure().Encrypt(true);
            //TODO: CHECK ENCRYPTION
            return(config);
        }
            // The cache may touch more bytes than the ones we modified.
            // We should be safe even if we don't get this test to pass.
            // The log file is not a public API yet anyway.
            // It's only needed for the PointerBasedIdSystem
            // With the new BTreeIdSystem it's not likely to become important
            // so we can safely ignore the failing write trash case.
            private IConfiguration BaseConfig(bool useLogFile)
            {
                Config4Impl config = (Config4Impl)Db4oFactory.NewConfiguration();

                config.ObjectClass(typeof(CrashSimulatingTestSuite.CrashData)).ObjectField("_name"
                                                                                           ).Indexed(true);
                config.ReflectWith(Platform4.ReflectorForType(typeof(CrashSimulatingTestSuite.CrashSimulatingTestCase
                                                                     )));
                config.BTreeNodeSize(4);
                config.LockDatabaseFile(false);
                config.FileBasedTransactionLog(useLogFile);
                ((CrashSimulatingTestSuite.LabeledConfig)IdSystem.Value).Configure(config);
                ((CrashSimulatingTestSuite.LabeledConfig)FreespaceManager.Value).Configure(config
                                                                                           );
                return(config);
            }
Example #17
0
 public virtual void Test()
 {
     if (WorkspaceServices.WorkspaceRoot == null)
     {
         Sharpen.Runtime.Err.WriteLine("Build environment not available. Skipping test case..."
                                       );
         return;
     }
     if (!System.IO.File.Exists(SourceFile()))
     {
         Sharpen.Runtime.Err.WriteLine("Test source file " + SourceFile() + " not available. Skipping test case..."
                                       );
         return;
     }
     Db4oFactory.Configure().AllowVersionUpdates(false);
     Db4oFactory.Configure().ReflectWith(Platform4.ReflectorForType(typeof(COR234TestCase
                                                                           )));
     Assert.Expect(typeof(OldFormatException), new _ICodeBlock_36(this));
 }
Example #18
0
        private IConfiguration MetaConfiguration()
        {
            var config = Db4oFactory.NewConfiguration();

            config.ExceptionsOnNotStorable(true);
            // the following line is only necessary for the tests to run
            // in OSGi environment
            config.ReflectWith(Platform4.ReflectorForType(typeof(CustomClassRepository)));
            Cascade(config, typeof(CustomClassRepository));
            Cascade(config, typeof(Hashtable4));
            Cascade(config, typeof(CustomClass));
            // FIXME: [TA] this is necessary because the behavior
            // on .net differs with regards to cascade activation
            // remove the following two lines and run the test
            // on .net to see it fail
            Cascade(config, typeof(CustomField));
            Cascade(config, typeof(CustomUidField));
            return(config);
        }
Example #19
0
        public ReplicationReflector(IReplicationProvider providerA, IReplicationProvider
                                    providerB, IReflector reflector)
        {
            if (reflector == null)
            {
                if ((_container = ContainerFrom(providerA)) != null)
                {
                    return;
                }
                if ((_container = ContainerFrom(providerB)) != null)
                {
                    return;
                }
            }
            GenericReflector genericReflector = new GenericReflector(null, reflector == null ?
                                                                     Platform4.ReflectorForType(typeof(Db4objects.Drs.Inside.ReplicationReflector)) :
                                                                     reflector);

            Platform4.RegisterCollections(genericReflector);
            _reflector = genericReflector;
        }
Example #20
0
 private Db4objects.Db4o.Reflect.Generic.GenericReflector GenericReflector()
 {
     return(new Db4objects.Db4o.Reflect.Generic.GenericReflector(null, Platform4.ReflectorForType
                                                                     (GetType())));
 }
Example #21
0
 // We could always use this, but we want to make users of this class
 // aware that they have control over the reflector and that it is
 // important.
 public static IReflector DefaultReflector()
 {
     return(new GenericReflector(Platform4.ReflectorForType(typeof(Prototypes))));
 }
 private object EmptyValue()
 {
     return(Platform4.ReflectorForType(typeof(DateTime)).ForClass(typeof(DateTime)).NullValue
                ());
 }