public void TestLandDataDeserializeNoAccessLists() { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); Dictionary <string, object> options = new Dictionary <string, object>(); LandData ld = LandDataSerializer.Deserialize(LandDataSerializer.Serialize(this.land, options)); Assert.That(ld, Is.Not.Null, "Deserialize(string) returned null"); // Assert.That(ld.AABBMax, Is.EqualTo(land.AABBMax)); // Assert.That(ld.AABBMin, Is.EqualTo(land.AABBMin)); Assert.That(ld.Area, Is.EqualTo(land.Area)); Assert.That(ld.AuctionID, Is.EqualTo(land.AuctionID)); Assert.That(ld.AuthBuyerID, Is.EqualTo(land.AuthBuyerID)); Assert.That(ld.Category, Is.EqualTo(land.Category)); Assert.That(ld.ClaimDate, Is.EqualTo(land.ClaimDate)); Assert.That(ld.ClaimPrice, Is.EqualTo(land.ClaimPrice)); Assert.That(ld.GlobalID, Is.EqualTo(land.GlobalID), "Reified LandData.GlobalID != original LandData.GlobalID"); Assert.That(ld.GroupID, Is.EqualTo(land.GroupID)); Assert.That(ld.Description, Is.EqualTo(land.Description)); Assert.That(ld.Flags, Is.EqualTo(land.Flags)); Assert.That(ld.LandingType, Is.EqualTo(land.LandingType)); Assert.That(ld.Name, Is.EqualTo(land.Name), "Reified LandData.Name != original LandData.Name"); Assert.That(ld.Status, Is.EqualTo(land.Status)); Assert.That(ld.LocalID, Is.EqualTo(land.LocalID)); Assert.That(ld.MediaAutoScale, Is.EqualTo(land.MediaAutoScale)); Assert.That(ld.MediaID, Is.EqualTo(land.MediaID)); Assert.That(ld.MediaURL, Is.EqualTo(land.MediaURL)); Assert.That(ld.OwnerID, Is.EqualTo(land.OwnerID)); }
protected internal void Save(ICollection <UUID> assetsFoundUuids, ICollection <UUID> assetsNotFoundUuids) { foreach (UUID uuid in assetsNotFoundUuids) { m_log.DebugFormat("[ARCHIVER]: Could not find asset {0}", uuid); } // m_log.InfoFormat( // "[ARCHIVER]: Received {0} of {1} assets requested", // assetsFoundUuids.Count, assetsFoundUuids.Count + assetsNotFoundUuids.Count); m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time."); // Write out control file m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile()); m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); // Write out region settings string settingsPath = String.Format("{0}{1}.xml", ArchiveConstants.SETTINGS_PATH, m_scene.RegionInfo.RegionName); m_archiveWriter.WriteFile(settingsPath, RegionSettingsSerializer.Serialize(m_scene.RegionInfo.RegionSettings)); m_log.InfoFormat("[ARCHIVER]: Added region settings to archive."); // Write out land data (aka parcel) settings List <ILandObject> landObjects = m_scene.LandChannel.AllParcels(); foreach (ILandObject lo in landObjects) { LandData landData = lo.LandData; string landDataPath = String.Format("{0}{1}.xml", ArchiveConstants.LANDDATA_PATH, landData.GlobalID.ToString()); m_archiveWriter.WriteFile(landDataPath, LandDataSerializer.Serialize(landData)); } m_log.InfoFormat("[ARCHIVER]: Added parcel settings to archive."); // Write out terrain string terrainPath = String.Format("{0}{1}.r32", ArchiveConstants.TERRAINS_PATH, m_scene.RegionInfo.RegionName); MemoryStream ms = new MemoryStream(); m_terrainModule.SaveToStream(terrainPath, ms); m_archiveWriter.WriteFile(terrainPath, ms.ToArray()); ms.Close(); m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive."); // Write out scene object metadata foreach (SceneObjectGroup sceneObject in m_sceneObjects) { //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject); m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject); } m_log.InfoFormat("[ARCHIVER]: Added scene objects to archive."); }
protected void Save(Scene scene, List <SceneObjectGroup> sceneObjects, string regionDir) { if (regionDir != string.Empty) { regionDir = ArchiveConstants.REGIONS_PATH + regionDir + "/"; } m_log.InfoFormat("[ARCHIVER]: Adding region settings to archive."); // Write out region settings string settingsPath = String.Format("{0}{1}{2}.xml", regionDir, ArchiveConstants.SETTINGS_PATH, scene.RegionInfo.RegionName); m_archiveWriter.WriteFile(settingsPath, RegionSettingsSerializer.Serialize(scene.RegionInfo.RegionSettings, scene.RegionEnvironment)); m_log.InfoFormat("[ARCHIVER]: Adding parcel settings to archive."); // Write out land data (aka parcel) settings List <ILandObject> landObjects = scene.LandChannel.AllParcels(); foreach (ILandObject lo in landObjects) { LandData landData = lo.LandData; string landDataPath = String.Format("{0}{1}", regionDir, ArchiveConstants.CreateOarLandDataPath(landData)); m_archiveWriter.WriteFile(landDataPath, LandDataSerializer.Serialize(landData, m_options)); } m_log.InfoFormat("[ARCHIVER]: Adding terrain information to archive."); // Write out terrain string terrainPath = String.Format("{0}{1}{2}.r32", regionDir, ArchiveConstants.TERRAINS_PATH, scene.RegionInfo.RegionName); using (MemoryStream ms = new MemoryStream()) { scene.RequestModuleInterface <ITerrainModule>().SaveToStream(terrainPath, ms); m_archiveWriter.WriteFile(terrainPath, ms.ToArray()); } m_log.InfoFormat("[ARCHIVER]: Adding scene objects to archive."); // Write out scene object metadata IRegionSerialiserModule serializer = scene.RequestModuleInterface <IRegionSerialiserModule>(); foreach (SceneObjectGroup sceneObject in sceneObjects) { //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); if (sceneObject.IsDeleted || sceneObject.inTransit) { continue; } string serializedObject = serializer.SerializeGroupToXml2(sceneObject, m_options); string objectPath = string.Format("{0}{1}", regionDir, ArchiveHelpers.CreateObjectPath(sceneObject)); m_archiveWriter.WriteFile(objectPath, serializedObject); } }
public void LandDataSerializerSerializeTest() { string serialized = LandDataSerializer.Serialize(this.land).Replace("\r\n", "\n"); Assert.That(serialized.Length > 0, "Serialize(LandData) returned empty string"); // adding a simple boolean variable because resharper nUnit integration doesn't like this // XML data in the Assert.That statement. Not sure why. bool result = (serialized == preSerialized); Assert.That(result, "result of Serialize LandData does not match expected result"); string serializedWithParcelAccessList = LandDataSerializer.Serialize(this.landWithParcelAccessList).Replace("\r\n", "\n"); Assert.That(serializedWithParcelAccessList.Length > 0, "Serialize(LandData) returned empty string for LandData object with ParcelAccessList"); result = (serializedWithParcelAccessList == preSerializedWithParcelAccessList); Assert.That(result, "result of Serialize(LandData) does not match expected result (pre-serialized with parcel access list"); }
public void TestLoadOarDeededLand() { TestHelpers.InMethod(); // TestHelpers.EnableLogging(); UUID landID = TestHelpers.ParseTail(0x10); MockGroupsServicesConnector groupsService = new MockGroupsServicesConnector(); IConfigSource configSource = new IniConfigSource(); IConfig config = configSource.AddConfig("Groups"); config.Set("Enabled", true); config.Set("Module", "GroupsModule"); config.Set("DebugEnabled", true); SceneHelpers.SetupSceneModules( m_scene, configSource, new object[] { new GroupsModule(), groupsService, new LandManagementModule() }); // Create group in scene for loading // FIXME: For now we'll put up with the issue that we'll get a group ID that varies across tests. UUID groupID = groupsService.CreateGroup(UUID.Zero, "group1", "", true, UUID.Zero, 3, true, true, true, UUID.Zero); // Construct OAR MemoryStream oarStream = new MemoryStream(); TarArchiveWriter tar = new TarArchiveWriter(oarStream); tar.WriteDir(ArchiveConstants.LANDDATA_PATH); tar.WriteFile( ArchiveConstants.CONTROL_FILE_PATH, new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup())); LandObject lo = new LandObject(groupID, true, m_scene); lo.SetLandBitmap(lo.BasicFullRegionLandBitmap()); LandData ld = lo.LandData; ld.GlobalID = landID; string ldPath = ArchiveConstants.CreateOarLandDataPath(ld); Dictionary <string, object> options = new Dictionary <string, object>(); tar.WriteFile(ldPath, LandDataSerializer.Serialize(ld, options)); tar.Close(); oarStream = new MemoryStream(oarStream.ToArray()); // Load OAR lock (this) { m_scene.EventManager.OnOarFileLoaded += LoadCompleted; m_archiverModule.DearchiveRegion(oarStream); } ILandObject rLo = m_scene.LandChannel.GetLandObject(16, 16); LandData rLd = rLo.LandData; Assert.That(rLd.GlobalID, Is.EqualTo(landID)); Assert.That(rLd.OwnerID, Is.EqualTo(groupID)); Assert.That(rLd.GroupID, Is.EqualTo(groupID)); Assert.That(rLd.IsGroupOwned, Is.EqualTo(true)); }