Skip to content

Commit

Permalink
Fix protocol/composer bugs on services (finos#2941)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelbey authored Jul 2, 2024
1 parent ccd2b9d commit e7507b8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static String composeTestAssertion(TestAssertion testAssertion, PureGramm
+ contentWithType.content + "\n"
+ indentedString + "}#";

return context.getIndentationString() + testAssertion.id + ":\n"
return context.getIndentationString() + PureGrammarComposerUtility.convertIdentifier(testAssertion.id) + ":\n"
+ assertionContent;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,16 @@

package org.finos.legend.engine.protocol.pure.v1.model.valueSpecification.raw.classInstance.path;

import org.finos.legend.engine.protocol.pure.v1.model.SourceInformation;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.Collections;
import java.util.List;
import org.finos.legend.engine.protocol.pure.v1.model.SourceInformation;

@JsonIgnoreProperties("_type")
public class Path
{
public SourceInformation sourceInformation;
public String name;
public String startType;
public List<PathElement> path = Collections.emptyList();

// @Override
// public <T> T accept(ValueSpecificationVisitor<T> visitor)
// {
// return visitor.visit(this);
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.finos.legend.engine.language.pure.grammar.to.DEPRECATED_PureGrammarComposerCore;
import org.finos.legend.engine.language.pure.grammar.to.HelperRuntimeGrammarComposer;
import org.finos.legend.engine.language.pure.grammar.to.PureGrammarComposerContext;
import org.finos.legend.engine.language.pure.grammar.to.PureGrammarComposerUtility;
import org.finos.legend.engine.language.pure.grammar.to.data.HelperEmbeddedDataGrammarComposer;
import org.finos.legend.engine.language.pure.grammar.to.test.assertion.HelperTestAssertionGrammarComposer;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.runtime.EngineRuntime;
Expand Down Expand Up @@ -120,7 +121,7 @@ public static String renderServiceTestSuite(ServiceTestSuite serviceTestSuite, P
int baseIndentation = 2;
StringBuilder str = new StringBuilder();

str.append(getTabString(baseIndentation)).append(serviceTestSuite.id).append(":\n");
str.append(getTabString(baseIndentation)).append(PureGrammarComposerUtility.convertIdentifier(serviceTestSuite.id)).append(":\n");
str.append(getTabString(baseIndentation)).append("{\n");

// testData
Expand Down Expand Up @@ -169,7 +170,7 @@ private static String renderServiceTest(ServiceTest test, int baseIndentation, P
{
StringBuilder str = new StringBuilder();

str.append(getTabString(baseIndentation)).append(test.id).append(":\n");
str.append(getTabString(baseIndentation)).append(PureGrammarComposerUtility.convertIdentifier(test.id)).append(":\n");
str.append(getTabString(baseIndentation)).append("{\n");

// SerializationFormat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private static String renderService(Service service, PureGrammarComposerContext
serviceBuilder.append(getTabString()).append("ownership: ").append(renderOwnership(service.ownership)).append(";\n");

}
serviceBuilder.append(getTabString()).append("documentation: ").append(convertString(service.documentation, true)).append(";\n");
serviceBuilder.append(getTabString()).append("documentation: ").append(convertString(service.documentation != null ? service.documentation : "", true)).append(";\n");
serviceBuilder.append(getTabString()).append("autoActivateUpdates: ").append(service.autoActivateUpdates ? "true" : "false").append(";\n");
Execution execution = service.execution;
if (execution instanceof PureExecution)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ public void testServiceTestSuite()
"}\n"
);

//Test Single TestSuite with data
//Test Single TestSuite with data and names with spaces
test("###Service\n" +
"Service meta::pure::myServiceSingle\n" +
"{\n" +
Expand All @@ -543,7 +543,7 @@ public void testServiceTestSuite()
" }\n" +
" testSuites:\n" +
" [\n" +
" testSuite1:\n" +
" 'test Suite 1':\n" +
" {\n" +
" data:\n" +
" [\n" +
Expand All @@ -559,11 +559,11 @@ public void testServiceTestSuite()
" ]\n" +
" tests:\n" +
" [\n" +
" test1:\n" +
" 'test 1':\n" +
" {\n" +
" asserts:\n" +
" [\n" +
" assert1:\n" +
" 'assert 1':\n" +
" EqualToJson\n" +
" #{\n" +
" expected:\n" +
Expand Down

0 comments on commit e7507b8

Please sign in to comment.