private static LocalAssetServicesConnector StartAssetService(TestsAssetCache cache)
        {
            IConfigSource config = new IniConfigSource();

            config.AddConfig("Modules");
            config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector");
            config.AddConfig("AssetService");
            config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
            config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");

            LocalAssetServicesConnector assetService = new LocalAssetServicesConnector();

            assetService.Initialise(config);

            if (cache != null)
            {
                IConfigSource cacheConfig = new IniConfigSource();
                cacheConfig.AddConfig("Modules");
                cacheConfig.Configs["Modules"].Set("AssetCaching", "TestsAssetCache");
                cacheConfig.AddConfig("AssetCache");

                cache.Initialise(cacheConfig);
            }

            return(assetService);
        }
Exemple #2
0
        private static LocalAssetServicesConnector StartAssetService(Scene testScene, CoreAssetCache cache)
        {
            LocalAssetServicesConnector assetService = new LocalAssetServicesConnector();
            IConfigSource config = new IniConfigSource();

            config.AddConfig("Modules");
            config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector");
            config.AddConfig("AssetService");
            config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
            config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");

            assetService.Initialise(config);
            assetService.AddRegion(testScene);

            if (cache != null)
            {
                IConfigSource cacheConfig = new IniConfigSource();
                cacheConfig.AddConfig("Modules");
                cacheConfig.Configs["Modules"].Set("AssetCaching", "CoreAssetCache");
                cacheConfig.AddConfig("AssetCache");

                cache.Initialise(cacheConfig);
                cache.AddRegion(testScene);
                cache.RegionLoaded(testScene);
                testScene.AddRegionModule(cache.Name, cache);
            }

            assetService.RegionLoaded(testScene);
            testScene.AddRegionModule(assetService.Name, assetService);

            return(assetService);
        }
Exemple #3
0
        public void TestAddTemporaryLocalAsset()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            IConfigSource config = new IniConfigSource();

            config.AddConfig("Modules");
            config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector");
            config.AddConfig("AssetService");
            config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
            config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");

            LocalAssetServicesConnector lasc = new LocalAssetServicesConnector();

            lasc.Initialise(config);

            // If it is local, it should not be stored
            AssetBase a1 = AssetHelpers.CreateNotecardAsset();

            a1.Local     = true;
            a1.Temporary = true;

            lasc.Store(a1);

            Assert.That(lasc.Get(a1.ID), Is.Null);
            Assert.That(lasc.GetData(a1.ID), Is.Null);
            Assert.That(lasc.GetMetadata(a1.ID), Is.Null);

            // TODO: Add cache and check that this does receive a copy of the asset
        }
Exemple #4
0
        public void TestAddTemporaryAsset()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            IConfigSource config = new IniConfigSource();

            config.AddConfig("Modules");
            config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector");
            config.AddConfig("AssetService");
            config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
            config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");

            LocalAssetServicesConnector lasc = new LocalAssetServicesConnector();

            lasc.Initialise(config);

            // If it is remote, it should be stored
            AssetBase a2 = AssetHelpers.CreateNotecardAsset();

            a2.Local     = false;
            a2.Temporary = true;

            lasc.Store(a2);

            AssetBase retreivedA2 = lasc.Get(a2.ID);

            Assert.That(retreivedA2.ID, Is.EqualTo(a2.ID));
            Assert.That(retreivedA2.Metadata.ID, Is.EqualTo(a2.Metadata.ID));
            Assert.That(retreivedA2.Data.Length, Is.EqualTo(a2.Data.Length));

            AssetMetadata retrievedA2Metadata = lasc.GetMetadata(a2.ID);

            Assert.That(retrievedA2Metadata.ID, Is.EqualTo(a2.ID));

            byte[] retrievedA2Data = lasc.GetData(a2.ID);
            Assert.That(retrievedA2Data.Length, Is.EqualTo(a2.Data.Length));

            // TODO: Add cache and check that this does receive a copy of the asset
        }
Exemple #5
0
        private static void StartAssetService(Scene testScene, bool real)
        {
            ISharedRegionModule assetService = new LocalAssetServicesConnector();
            IConfigSource       config       = new IniConfigSource();

            config.AddConfig("Modules");
            config.AddConfig("AssetService");
            config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector");
            if (real)
            {
                config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
            }
            else
            {
                config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService");
            }
            config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
            assetService.Initialise(config);
            assetService.AddRegion(testScene);
            assetService.RegionLoaded(testScene);
            testScene.AddRegionModule(assetService.Name, assetService);
            m_assetService = assetService;
        }