Пример #1
0
 public virtual void Test()
 {
     File4.Delete(TempFile());
     Assert.IsFalse(Exists(TempFile()));
     IObjectContainer oc = Db4oEmbedded.OpenFile(NewConfiguration(), TempFile());
     oc.Close();
     File4.Delete(TempFile());
     Assert.IsFalse(Exists(TempFile()));
 }
Пример #2
0
        /// <exception cref="System.Exception"></exception>
        public virtual void TearDown()
        {
            var tempTestFilePath = DbFilePath();

            if (File.Exists(tempTestFilePath))
            {
                File4.Delete(tempTestFilePath);
            }
        }
Пример #3
0
        private string SaveOldAs(string oldFileName)
        {
            string newPath;

            newPath = Path.GetTempFileName();
            File4.Delete(newPath);
            _storage.SaveAs(oldFileName, newPath);
            return(newPath);
        }
Пример #4
0
        /// <exception cref="System.Exception"></exception>
        public override void SetUp()
        {
            File4.Delete(TempFile());
            IoAdapter adapter = new RandomAccessFileAdapter();

            adapter = adapter.Open(TempFile(), false, 0, false);
            adapter.Write(new byte[] { 1, 2, 3 }, 3);
            adapter.Close();
        }
Пример #5
0
        /// <exception cref="System.Exception"></exception>
        public virtual void TearDown()
        {
            string tempTestFilePath = DbFilePath();

            if (System.IO.File.Exists(tempTestFilePath))
            {
                File4.Delete(tempTestFilePath);
            }
        }
Пример #6
0
        /// <summary>Deletes the directory</summary>
        /// <exception cref="System.IO.IOException"></exception>
        public static void DeleteDir(string dir)
        {
            string absolutePath = new Sharpen.IO.File(dir).GetCanonicalPath();

            Sharpen.IO.File fDir = new Sharpen.IO.File(dir);
            if (fDir.IsDirectory())
            {
                string[] files = fDir.List();
                for (int i = 0; i < files.Length; i++)
                {
                    DeleteDir(Path.Combine(absolutePath, files[i]));
                }
            }
            File4.Delete(dir);
        }
Пример #7
0
        /// <summary>Deletes the directory</summary>
        /// <exception cref="System.IO.IOException"></exception>
        public static void DeleteDir(string dir)
        {
            var absolutePath = new File(dir).GetCanonicalPath();
            var fDir         = new File(dir);

            if (fDir.IsDirectory())
            {
                var files = fDir.List();
                for (var i = 0; i < files.Length; i++)
                {
                    DeleteDir(Path.Combine(absolutePath, files[i]));
                }
            }
            File4.Delete(dir);
        }
Пример #8
0
        public virtual void Test()
        {
            IEmbeddedConfiguration configuration = NewConfiguration();

            ConfigurationItemTestCase.ConfigurationItemStub item = new ConfigurationItemTestCase.ConfigurationItemStub
                                                                       ();
            configuration.Common.Add(item);
            Assert.AreSame(LegacyConfigFor(configuration), item.PreparedConfiguration());
            Assert.IsNull(item.AppliedContainer());
            File4.Delete(TempFile());
            IObjectContainer container = Db4oEmbedded.OpenFile(configuration, TempFile());

            container.Close();
            Assert.AreSame(container, item.AppliedContainer());
        }
Пример #9
0
 public virtual void TestExistingFileWillNotBeOverWritten()
 {
     Db().Store(new Item(1));
     var oldFileName = FileSession().FileName();
     var newPath = new ByRef();
     try
     {
         newPath.value = Path.GetTempFileName();
         Assert.IsTrue(File.Exists(((string) newPath.value)));
         Assert.Expect(typeof (InvalidOperationException), new _ICodeBlock_34(this, oldFileName
             , newPath));
         AssertItems(Db(), 1);
     }
     finally
     {
         File4.Delete(((string) newPath.value));
     }
 }
        /// <exception cref="System.Exception"></exception>
        public virtual void Test()
        {
            string fileName = DatabaseFile();

            File4.Delete(fileName);
            IObjectServer server = Db4oClientServer.OpenServer(CreateServerConfiguration(), fileName
                                                               , -1);

            _port = server.Ext().Port();
            try
            {
                server.GrantAccess("db4o", "db4o");
                RunTest();
            }
            finally
            {
                server.Close();
                File4.Delete(fileName);
            }
        }
Пример #11
0
        public virtual void Run()
        {
            Sharpen.Runtime.Out.WriteLine("MonitoringDemo will run forever to allow you to see JMX/Perfmon statistics."
                                          );
            Sharpen.Runtime.Out.WriteLine("Cancel running with CTRL + C");
            File4.Delete(DatabaseFileName);
            IObjectContainer objectContainer = OpenContainer();

            StorePermanentObjects(objectContainer);
            try
            {
                while (true)
                {
                    StoreTemporaryObjects(objectContainer);
                    ExecuteQueries(objectContainer);
                    DeleteTemporaryObjects(objectContainer);
                }
            }
            finally
            {
                Close(objectContainer);
            }
        }
        private void CreateDatabase(string file)
        {
            if (!IsApplicableForDb4oVersion())
            {
                return;
            }
            System.IO.Directory.CreateDirectory(DatabasePath);
            if (System.IO.File.Exists(file))
            {
                File4.Delete(file);
            }
            IExtObjectContainer     objectContainer = Db4oFactory.OpenFile(file).Ext();
            IObjectContainerAdapter adapter         = ObjectContainerAdapterFactory.ForVersion(Db4oMajorVersion
                                                                                                   (), Db4oMinorVersion()).ForContainer(objectContainer);

            try
            {
                Store(adapter);
            }
            finally
            {
                objectContainer.Close();
            }
        }
Пример #13
0
 /// <exception cref="System.Exception"></exception>
 public override void TearDown()
 {
     File4.Delete(Defgared);
     base.TearDown();
 }
 private void DeleteLogFile()
 {
     File4.Delete(LogFileName(_fileName));
 }
 /// <exception cref="System.Exception"></exception>
 protected override void Db4oTearDownBeforeClean()
 {
     File4.Delete(DatabaseFile);
 }
Пример #16
0
 public virtual void Purge(string url)
 {
     File4.Delete(url);
     File4.Delete(MetadataFile(url));
 }
 /// <exception cref="System.Exception"></exception>
 protected override void Db4oTearDownBeforeClean()
 {
     base.Db4oTearDownBeforeClean();
     File4.Delete(BackupFile);
 }
 /// <exception cref="System.Exception"></exception>
 protected override void Db4oSetupBeforeStore()
 {
     base.Db4oSetupBeforeStore();
     File4.Delete(BackupFile);
 }
Пример #19
0
 private void DeleteAllFiles()
 {
     File4.Delete(SourceFile());
     File4.Delete(BackupFile());
 }
Пример #20
0
 private void DeleteFile(string fname)
 {
     File4.Delete(fname);
 }
Пример #21
0
 /// <exception cref="System.IO.IOException"></exception>
 public virtual void Delete(string uri)
 {
     File4.Delete(uri);
 }
Пример #22
0
 internal static void DeleteFiles()
 {
     File4.Delete(MainfileName);
     File4.Delete(FilenameA);
     File4.Delete(FilenameB);
 }
Пример #23
0
 private static void DeleteDataFile()
 {
     File4.Delete(DataFile);
 }
 private void TearDownClientServer(string testFileName)
 {
     File4.Delete(ClientServerFileName(testFileName));
 }
Пример #25
0
 /// <exception cref="System.Exception"></exception>
 public virtual void TearDown()
 {
     File4.Delete(TempFile());
 }