Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/ServiceControl.Audit/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ These settings are only here so that we can debug ServiceControl while developin

<add key="ServiceControl.Audit/PersistenceType" value="InMemory" />

<add key="ServiceControl.Audit/PersistenceType" value="RavenDb35" />
<add key="ServiceControl.Audit/RavenDB35/RunInMemory" value="true" />

<add key="ServiceControl.Audit/PersistenceType" value="RavenDb5" />
<add key="ServiceControl.Audit/DBPath" value="%TEMP%\audit_db" />
<add key="ServiceControl.Audit/LogPath" value="%TEMP%\audit_logs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ WORKDIR /servicecontrol

ARG TRANSPORT

ADD /Particular.ServiceControl/ServiceControl /Transports/${TRANSPORT} /Particular.ServiceControl/Persisters/RavenDB35 ./
ADD /Particular.ServiceControl/ServiceControl /Transports/${TRANSPORT} /Particular.ServiceControl/Persisters/RavenDB5 ./

ARG TRANSPORT_CUSTOMIZATION_TYPE

ENV "ServiceControl/TransportType"="${TRANSPORT_CUSTOMIZATION_TYPE}" \
"ServiceControl/PersistenceType"="ServiceControl.Persistence.RavenDb.RavenDbPersistenceConfiguration, ServiceControl.Persistence.RavenDb" \
"ServiceControl/PersistenceType"="ServiceControl.Persistence.RavenDb.RavenDbPersistenceConfiguration, ServiceControl.Persistence.RavenDb5" \
"ServiceControl/Hostname"="*" \
"ServiceControl/DBPath"="C:\\Data\\DB\\" \
"ServiceControl/LogPath"="C:\\Data\\Logs\\" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ WORKDIR /servicecontrol.audit

ARG TRANSPORT

ADD /Particular.ServiceControl.Audit/ServiceControl.Audit /Transports/${TRANSPORT} /Particular.ServiceControl.Audit/Persisters/RavenDB35 ./
ADD /Particular.ServiceControl.Audit/ServiceControl.Audit /Transports/${TRANSPORT} /Particular.ServiceControl.Audit/Persisters/RavenDB5 ./

ARG TRANSPORT_CUSTOMIZATION_TYPE

ENV "ServiceControl.Audit/TransportType"="${TRANSPORT_CUSTOMIZATION_TYPE}" \
"ServiceControl.Audit/PersistenceType"="ServiceControl.Audit.Persistence.RavenDb.RavenDbPersistenceConfiguration, ServiceControl.Audit.Persistence.RavenDb" \
"ServiceControl.Audit/PersistenceType"="ServiceControl.Audit.Persistence.RavenDb.RavenDbPersistenceConfiguration, ServiceControl.Audit.Persistence.RavenDb5" \
"ServiceControl.Audit/Hostname"="*" \
"ServiceControl.Audit/DBPath"="C:\\Data\\DB\\" \
"ServiceControl.Audit/LogPath"="C:\\Data\\Logs\\" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ WORKDIR /servicecontrol.audit

ARG TRANSPORT

ADD /Particular.ServiceControl.Audit/ServiceControl.Audit /Transports/${TRANSPORT} /Particular.ServiceControl.Audit/Persisters/RavenDB35 ./
ADD /Particular.ServiceControl.Audit/ServiceControl.Audit /Transports/${TRANSPORT} /Particular.ServiceControl.Audit/Persisters/RavenDB5 ./

ARG TRANSPORT_CUSTOMIZATION_TYPE

ENV "ServiceControl.Audit/TransportType"="${TRANSPORT_CUSTOMIZATION_TYPE}" \
"ServiceControl.Audit/PersistenceType"="ServiceControl.Audit.Persistence.RavenDb.RavenDbPersistenceConfiguration, ServiceControl.Audit.Persistence.RavenDb" \
"ServiceControl.Audit/PersistenceType"="ServiceControl.Audit.Persistence.RavenDb.RavenDbPersistenceConfiguration, ServiceControl.Audit.Persistence.RavenDb5" \
"ServiceControl.Audit/Hostname"="*" \
"ServiceControl.Audit/DBPath"="C:\\Data\\DB\\" \
"ServiceControl.Audit/LogPath"="C:\\Data\\Logs\\" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ WORKDIR /servicecontrol

ARG TRANSPORT

ADD /Particular.ServiceControl/ServiceControl /Transports/${TRANSPORT} /Particular.ServiceControl/Persisters/RavenDB35 ./
ADD /Particular.ServiceControl/ServiceControl /Transports/${TRANSPORT} /Particular.ServiceControl/Persisters/RavenDB5 ./

ARG TRANSPORT_CUSTOMIZATION_TYPE

ENV "ServiceControl/TransportType"="${TRANSPORT_CUSTOMIZATION_TYPE}" \
"ServiceControl/PersistenceType"="ServiceControl.Persistence.RavenDb.RavenDbPersistenceConfiguration, ServiceControl.Persistence.RavenDb" \
"ServiceControl/PersistenceType"="ServiceControl.Persistence.RavenDb.RavenDbPersistenceConfiguration, ServiceControl.Persistence.RavenDb5" \
"ServiceControl/Hostname"="*" \
"ServiceControl/DBPath"="C:\\Data\\DB\\" \
"ServiceControl/LogPath"="C:\\Data\\Logs\\" \
Expand Down
3 changes: 0 additions & 3 deletions src/ServiceControl/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ These settings are only here so that we can debug ServiceControl while developin

<add key="ServiceControl/PersistenceType" value="InMemory" />

<add key="ServiceControl/PersistenceType" value="RavenDb35" />
<add key="ServiceControl/RavenDB35/RunInMemory" value="true" />

<add key="ServiceControl/PersistenceType" value="RavenDb5" />
<add key="ServiceControl/DBPath" value="%TEMP%\primary_db" />
<add key="ServiceControl/LogPath" value="%TEMP%\primary_logs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public override void Reload()

if (string.IsNullOrEmpty(persistenceType))
{
// Must always remain RavenDB35 so that SCMU understands that an instance with no configured value is an old Raven 3.5 instance
PersistenceManifest = manifests.Single(m => m.Name == "RavenDB35");
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public static ServiceControlAuditNewInstance CreateWithDefaultPersistence()

public static ServiceControlAuditNewInstance CreateWithDefaultPersistence(string deploymentCachePath)
{
return CreateWithPersistence(deploymentCachePath, DefaultPersister);
const string persisterToUseForBrandNewInstances = "RavenDB5";
return CreateWithPersistence(deploymentCachePath, persisterToUseForBrandNewInstances);
}

public static ServiceControlAuditNewInstance CreateWithPersistence(string deploymentCachePath, string persistence)
Expand Down Expand Up @@ -98,7 +99,5 @@ public override void CopyFiles(string zipFilePath)

FileUtils.UnzipToSubdirectory(zipFilePath, InstallPath, $@"Persisters\{PersistenceManifest.Name}");
}

const string DefaultPersister = "RavenDB5";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ public override void Reload()

if (string.IsNullOrEmpty(persistenceType))
{
PersistenceManifest = manifests.Single(m => m.Name == ServiceControlNewInstance.DefaultPersister);
// Must always remain RavenDB35 so that SCMU understands that an instance with no configured value is an old Raven 3.5 instance
PersistenceManifest = manifests.Single(m => m.Name == "RavenDB35");
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public static ServiceControlNewInstance CreateWithDefaultPersistence()

public static ServiceControlNewInstance CreateWithDefaultPersistence(string deploymentCachePath)
{
return CreateWithPersistence(deploymentCachePath, DefaultPersister);
const string persisterUsedForBrandNewInstances = "RavenDB5";
return CreateWithPersistence(deploymentCachePath, persisterUsedForBrandNewInstances);
}

public static ServiceControlNewInstance CreateWithPersistence(string deploymentCachePath, string persistence)
Expand Down Expand Up @@ -152,8 +153,5 @@ public static ServiceControlNewInstance Load(string path)

return instanceData;
}

// TODO: Change after Raven5 introduced
public const string DefaultPersister = "RavenDB35";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ public AuditDeploymentPackageTests()
[Test]
public void Should_package_storages_individually()
{
var expectedPersisters = new string[] {
"RavenDB35",
var expectedPersisters = new[] {
"RavenDB35", // Still must exist, as Raven35 persistence.manifest file must be available for SCMU to understand old versions
"RavenDB5",
"InMemory"};
"InMemory"
};

var persisters = deploymentPackage.DeploymentUnits.Where(u => u.Category == "Persisters");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
namespace Tests
{
using System.IO;
using System.Linq;
using NUnit.Framework;

Expand All @@ -13,10 +12,22 @@ public PrimaryDeploymentPackageTests()
}

[Test]
public void Should_bundle_ravendb35_persister()
public void Should_package_storages_individually()
{
var persistenceAssemblyPath = Path.Combine(deploymentPackage.Directory.FullName, "Persisters", "RavenDB35", "ServiceControl.Persistence.RavenDb.dll");
FileAssert.Exists(persistenceAssemblyPath, "RavenDB 3.5 persister should be bundled");
var expectedPersisters = new[] {
"RavenDB35", // Still must exist, as Raven35 persistence.manifest file must be available for SCMU to understand old versions
"RavenDB5"
};

var persisters = deploymentPackage.DeploymentUnits.Where(u => u.Category == "Persisters");

CollectionAssert.AreEquivalent(expectedPersisters, persisters.Select(d => d.Name), $"Expected persisters folder to contain {string.Join(",", expectedPersisters)}");

foreach (var persister in persisters)
{
Assert.IsFalse(persister.Files.Any(f => f.Name.EndsWith(".config")), $"{persister.Name} contains a config file");
Assert.IsTrue(persister.Files.Any(f => f.Name == "persistence.manifest"), $"{persister.Name} doesn't contain a persistence.manifest file");
}
}

readonly DeploymentPackage deploymentPackage;
Expand Down