GetData() public method

public GetData ( string id ) : byte[]
id string
return byte[]
Ejemplo n.º 1
0
        public void TestAddAsset()
        {
            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);

            AssetBase a1 = AssetHelpers.CreateNotecardAsset();
            lasc.Store(a1);

            AssetBase retreivedA1 = lasc.Get(a1.ID);
            Assert.That(retreivedA1.ID, Is.EqualTo(a1.ID));
            Assert.That(retreivedA1.Metadata.ID, Is.EqualTo(a1.Metadata.ID));
            Assert.That(retreivedA1.Data.Length, Is.EqualTo(a1.Data.Length));

            AssetMetadata retrievedA1Metadata = lasc.GetMetadata(a1.ID);
            Assert.That(retrievedA1Metadata.ID, Is.EqualTo(a1.ID));

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

            // TODO: Add cache and check that this does receive a copy of the asset
        }
Ejemplo n.º 2
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
        }