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
6 changes: 0 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# syntax=docker/dockerfile:experimental
ARG DbVersion=7000072

FROM sillsdev/web-languageforge:latest AS lf-build
# No changes needed, LF app result in /var/www/html

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS lfmerge-builder-base
WORKDIR /build/lfmerge

Expand Down Expand Up @@ -61,9 +58,6 @@ ENV NUNIT_VERSION_MAJOR=3

FROM lfmerge-build-${DbVersion} AS lfmerge-build

# LanguageForge repo expected to be in /var/www/html (will be copied into ./data/php/src before running unit tests)
COPY --chown=builder:users --from=lf-build /var/www/html /var/www/html

USER builder

# Git repo should be mounted under ${HOME}/packages/lfmerge when run
Expand Down
3 changes: 0 additions & 3 deletions docker/scripts/build-and-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ echo After setup-workspace.sh, pwd is $(pwd)
"$SCRIPT_DIR"/compile-lfmerge-combined.sh ${DbVersion}

if [ -n "$RUN_UNIT_TESTS" -a "$RUN_UNIT_TESTS" -ne 0 ]; then
rm -rf "$SCRIPT_DIR"/data/php
mkdir -p "$SCRIPT_DIR"/data/php
cp -a /var/www/html "$SCRIPT_DIR"/data/php/src
"$SCRIPT_DIR"/test-lfmerge-combined.sh ${DbVersion}
fi

Expand Down

This file was deleted.

30 changes: 0 additions & 30 deletions src/LfMerge.Core.Tests/LanguageForgeProxyMock.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/LfMerge.Core.Tests/TestDoubles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public bool SetInputSystems(ILfProject project, Dictionary<string, LfInputSystem
return true;
}

public bool SetCustomFieldConfig(ILfProject project, Dictionary<string, LfConfigFieldBase> lfCustomFieldList)
public bool SetCustomFieldConfig(ILfProject project, Dictionary<string, LfConfigFieldBase> lfCustomFieldList, Dictionary<string, string> lfCustomFieldTypes)
{
if (lfCustomFieldList == null)
_storedCustomFieldConfig = new Dictionary<string, LfConfigFieldBase>();
Expand Down
11 changes: 3 additions & 8 deletions src/LfMerge.Core.Tests/TestEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,13 @@ static TestEnvironment()
public TestEnvironment(bool registerSettingsModelDouble = true,
bool registerProcessingStateDouble = true,
bool resetLfProjectsDuringCleanup = true,
TemporaryFolder languageForgeServerFolder = null,
bool registerLfProxyMock = true)
TemporaryFolder languageForgeServerFolder = null)
{
_resetLfProjectsDuringCleanup = resetLfProjectsDuringCleanup;
_languageForgeServerFolder = languageForgeServerFolder ?? new TemporaryFolder(TestName + Path.GetRandomFileName());
Environment.SetEnvironmentVariable("FW_CommonAppData", _languageForgeServerFolder.Path);
MainClass.Container = RegisterTypes(registerSettingsModelDouble,
registerProcessingStateDouble, _languageForgeServerFolder.Path,
registerLfProxyMock).Build();
registerProcessingStateDouble, _languageForgeServerFolder.Path).Build();
Settings = MainClass.Container.Resolve<LfMergeSettings>();
MainClass.Logger = MainClass.Container.Resolve<ILogger>();
Directory.CreateDirectory(Settings.LcmDirectorySettings.ProjectsDirectory);
Expand All @@ -71,7 +69,7 @@ private string TestName
}

private ContainerBuilder RegisterTypes(bool registerSettingsModel,
bool registerProcessingStateDouble, string temporaryFolder, bool registerLfProxyMock)
bool registerProcessingStateDouble, string temporaryFolder)
{
var containerBuilder = MainClass.RegisterTypes();
containerBuilder.RegisterType<LfMergeSettingsDouble>()
Expand All @@ -83,9 +81,6 @@ private ContainerBuilder RegisterTypes(bool registerSettingsModel,

containerBuilder.RegisterType<MongoConnectionDouble>().As<IMongoConnection>().SingleInstance();

if (registerLfProxyMock)
containerBuilder.RegisterType<LanguageForgeProxyMock>().As<ILanguageForgeProxy>();

if (registerSettingsModel)
{
containerBuilder.RegisterType<ChorusHelperDouble>().As<ChorusHelper>().SingleInstance();
Expand Down
24 changes: 0 additions & 24 deletions src/LfMerge.Core/DataConverters/ConvertLcmToMongoCustomField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public class ConvertLcmToMongoCustomField
};

private Dictionary<Guid, string> GuidToListCode;
private Dictionary<string, string> _fieldNameToFieldType;

public ConvertLcmToMongoCustomField(LcmCache cache, FwServiceLocatorCache serviceLocator, ILogger logger)
{
Expand All @@ -69,28 +68,6 @@ public ConvertLcmToMongoCustomField(LcmCache cache, FwServiceLocatorCache servic
{servLoc.LanguageProject.StatusOA.Guid, MagicStrings.LfOptionListCodeForStatus},
{servLoc.LanguageProject.LexDbOA.UsageTypesOA.Guid, MagicStrings.LfOptionListCodeForUsageTypes}
};
_fieldNameToFieldType = new Dictionary<string, string>();
}

public bool CreateCustomFieldsConfigViews(ILfProject project, Dictionary<string, LfConfigFieldBase> lfCustomFieldList, Dictionary<string, string> lfCustomFieldTypes)
{
return CreateCustomFieldsConfigViews(project, lfCustomFieldList, lfCustomFieldTypes, false);
}

public bool CreateCustomFieldsConfigViews(ILfProject project, Dictionary<string, LfConfigFieldBase> lfCustomFieldList, Dictionary<string, string> lfCustomFieldTypes, bool isTest)
{
var customFieldSpecs = new List<CustomFieldSpec>();
foreach (string lfCustomFieldName in lfCustomFieldList.Keys)
{
customFieldSpecs.Add(new CustomFieldSpec(lfCustomFieldName, _fieldNameToFieldType[lfCustomFieldName]));
}

var lfproxy = MainClass.Container.Resolve<ILanguageForgeProxy>();
string output = lfproxy.UpdateCustomFieldViews(project.ProjectCode, customFieldSpecs, isTest);

if (string.IsNullOrEmpty(output) || output == "false")
return false;
return true;
}

/// <summary>
Expand Down Expand Up @@ -157,7 +134,6 @@ Dictionary<string, string> lfCustomFieldTypes
continue;
string lfCustomFieldName = ConvertUtilities.NormalizedFieldName(label, fieldSourceType);
CellarPropertyType LcmFieldType = (CellarPropertyType)LcmMetaData.GetFieldType(flid);
_fieldNameToFieldType[lfCustomFieldName] = LcmFieldType.ToString(); // TODO: Comment this one OUT. Bad design.
lfCustomFieldTypes[lfCustomFieldName] = LcmFieldType.ToString();
string lfCustomFieldType;
if (CellarPropertyTypeToLfCustomFieldType.TryGetValue(LcmFieldType, out lfCustomFieldType))
Expand Down
3 changes: 1 addition & 2 deletions src/LfMerge.Core/DataConverters/ConvertLcmToMongoLexicon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ public void RunConversion()
Dictionary<string, LfConfigFieldBase> lfCustomFieldList = new Dictionary<string, LfConfigFieldBase>();
Dictionary<string, string> lfCustomFieldTypes = new Dictionary<string, string>();
_convertCustomField.WriteCustomFieldConfig(lfCustomFieldList, lfCustomFieldTypes);
Connection.SetCustomFieldConfig(LfProject, lfCustomFieldList);
_convertCustomField.CreateCustomFieldsConfigViews(LfProject, lfCustomFieldList, lfCustomFieldTypes);
Connection.SetCustomFieldConfig(LfProject, lfCustomFieldList, lfCustomFieldTypes);

Dictionary<Guid, DateTime> previousModificationDates = Connection.GetAllModifiedDatesForEntries(LfProject);

Expand Down
63 changes: 63 additions & 0 deletions src/LfMerge.Core/LanguageForge/Config/LfRoleOrUserViewConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using System.Collections.Generic;
using MongoDB.Bson;

namespace LfMerge.Core.LanguageForge.Config
{
public class LexRoleOrUserViewConfig
{
public string[] InputSystems;
public Dictionary<string,LexViewFieldConfig> Fields;
public Dictionary<string,bool> ShowTasks;
}

public class LexViewFieldConfig
{
public bool Show;
public string Type;

public LexViewFieldConfig(string type, bool show = true)
{
Show = show;
Type = type;
}
public LexViewFieldConfig(bool show = true) : this("basic", show) {}
}

public class LexViewMultiTextFieldConfig: LexViewFieldConfig
{
public bool OverrideInputSystems;
public string[] InputSystems;

public LexViewMultiTextFieldConfig(bool show = true) : base("multitext", show)
{
this.OverrideInputSystems = false;
this.InputSystems = new string[]{};
}
}

public static class LexViewFieldConfigFactory
{
public static LexViewFieldConfig CreateByType(string lfCustomFieldType, bool show = true) {
if (lfCustomFieldType == "MultiUnicode" || lfCustomFieldType == "MultiString" || lfCustomFieldType == "String") {
return new LexViewMultiTextFieldConfig(show);
} else {
return new LexViewFieldConfig(show);
}
}

public static BsonDocument CreateBsonDocumentByType(string lfCustomFieldType, bool show = true) {
LexViewFieldConfig config = CreateByType(lfCustomFieldType, show);
var result = new BsonDocument();
result.Set("show", new BsonBoolean(config.Show));
result.Set("type", new BsonString(config.Type));
var multiTextConfig = config as LexViewMultiTextFieldConfig;
if (multiTextConfig != null) {
result.Set("overrideInputSystems", new BsonBoolean(multiTextConfig.OverrideInputSystems));
if (multiTextConfig.InputSystems != null && multiTextConfig.InputSystems.Length > 0) {
result.Set("inputSystems", new BsonArray(multiTextConfig.InputSystems));
}
}
return result;
}
}
}

This file was deleted.

Loading