Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit b0cb6f8

Browse files
committed
#376 Generated model artifact files now have "GENERATED" at the end of their filename
1 parent 61f9356 commit b0cb6f8

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/main/java/com/marklogic/appdeployer/command/es/GenerateModelArtifactsCommand.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ protected void generateInstanceConverter(AppConfig appConfig, GeneratedCode code
124124
}
125125
return;
126126
}
127-
out = new File(esDir, code.getTitle() + "-" + code.getVersion() + "-GENERATED.xqy");
127+
out = new File(esDir, code.getTitle() + "-" + code.getVersion() + ".xqy.GENERATED");
128128
logMessage = "Instance converter does not match existing file, so writing to: ";
129129
}
130130
try {
@@ -152,7 +152,7 @@ protected void generateSearchOptions(GeneratedCode code, File modulesDir) {
152152
}
153153
return;
154154
}
155-
out = new File(optionsDir, code.getTitle() + "-GENERATED.xml");
155+
out = new File(optionsDir, code.getTitle() + "xml.GENERATED");
156156
logMessage = "Search options does not match existing file, so writing to: ";
157157
}
158158
try {
@@ -187,7 +187,7 @@ protected void generateDatabaseProperties(AppConfig appConfig, GeneratedCode cod
187187
}
188188
return;
189189
}
190-
out = new File(dbDir, "content-database-GENERATED.json");
190+
out = new File(dbDir, "content-database.json.GENERATED");
191191
logMessage = "Database properties does not match existing file, so writing to: ";
192192
}
193193
try {
@@ -226,7 +226,7 @@ protected void generateSchema(AppConfig appConfig, GeneratedCode code) {
226226
}
227227
return;
228228
}
229-
out = new File(dir, code.getTitle() + "-" + code.getVersion() + "-GENERATED.xsd");
229+
out = new File(dir, code.getTitle() + "-" + code.getVersion() + "xsd.GENERATED");
230230
logMessage = "Schema does not match existing file, so writing to: ";
231231
}
232232
try {
@@ -256,7 +256,7 @@ protected void generateExtractionTemplate(AppConfig appConfig, GeneratedCode cod
256256
}
257257
return;
258258
}
259-
out = new File(dir, code.getTitle() + "-" + code.getVersion() + "-GENERATED.tdex");
259+
out = new File(dir, code.getTitle() + "-" + code.getVersion() + "tdex.GENERATED");
260260
logMessage = "Extraction template does not match existing file, so writing to: ";
261261
}
262262
try {

src/test/java/com/marklogic/appdeployer/command/es/GenerateModelArtifactsTest.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
import com.marklogic.appdeployer.command.restapis.DeployRestApiServersCommand;
77
import com.marklogic.client.DatabaseClient;
88
import com.marklogic.client.io.StringHandle;
9+
import org.apache.commons.io.FileUtils;
910
import org.junit.After;
1011
import org.junit.Test;
1112

1213
import java.io.File;
14+
import java.io.IOException;
1315

1416
public class GenerateModelArtifactsTest extends AbstractAppDeployerTest {
1517

@@ -19,12 +21,13 @@ public void tearDown() {
1921
}
2022

2123
@Test
22-
public void test() {
24+
public void test() throws IOException {
2325
String projectPath = "src/test/resources/entity-services-project";
2426
File srcDir = new File(projectPath, "src");
2527
if (srcDir.exists()) {
26-
srcDir.delete();
28+
FileUtils.cleanDirectory(srcDir);
2729
}
30+
2831
appConfig.setConfigDir(new ConfigDir(new File(projectPath + "/src/main/ml-config")));
2932
appConfig.setModelsPath(projectPath + "/data/entity-services");
3033
appConfig.getModulePaths().clear();
@@ -57,10 +60,10 @@ public void test() {
5760
deploySampleApp();
5861

5962
// These shouldn't exist because the content is the same
60-
assertFalse(new File(projectPath, "src/main/ml-modules/ext/entity-services/Race-0.0.1-GENERATED.xqy").exists());
61-
assertFalse(new File(projectPath, "src/main/ml-modules/options/Race-GENERATED.xml").exists());
62-
assertFalse(new File(projectPath, "src/main/ml-config/databases/content-database-GENERATED.json").exists());
63-
assertFalse(new File(projectPath, "src/main/ml-schemas/Race-0.0.1-GENERATED.xsd").exists());
64-
assertFalse(new File(projectPath, "src/main/ml-schemas/Race-0.0.1-GENERATED.tdex").exists());
63+
assertFalse(new File(projectPath, "src/main/ml-modules/ext/entity-services/Race-0.0.1.xqy.GENERATED").exists());
64+
assertFalse(new File(projectPath, "src/main/ml-modules/options/Race.xml.GENERATED").exists());
65+
assertFalse(new File(projectPath, "src/main/ml-config/databases/content-database.json.GENERATED").exists());
66+
assertFalse(new File(projectPath, "src/main/ml-schemas/Race-0.0.1.xsd.GENERATED").exists());
67+
assertFalse(new File(projectPath, "src/main/ml-schemas/Race-0.0.1.tdex.GENERATED").exists());
6568
}
6669
}

0 commit comments

Comments
 (0)