use of com.devonfw.cobigen.api.extension.Merger in project cobigen by devonfw.
the class HTMLPluginActivator method bindMerger.
@Override
public List<Merger> bindMerger() {
List<Merger> merger = Lists.newLinkedList();
merger.add(new AngularMerger(NG_MERGE, false));
merger.add(new AngularMerger(NG_MERGE_OVERRIDE, true));
return merger;
}
use of com.devonfw.cobigen.api.extension.Merger in project cobigen by devonfw.
the class TypeScriptPluginActivator method bindMerger.
@Override
public List<Merger> bindMerger() {
List<Merger> merger = Lists.newLinkedList();
merger.add(new TypeScriptMerger(this.externalProcess, TSMERGE, false));
merger.add(new TypeScriptMerger(this.externalProcess, TSMERGE_OVERRIDE, true));
return merger;
}
use of com.devonfw.cobigen.api.extension.Merger in project cobigen by devonfw.
the class JSONPluginActivator method bindMerger.
@Override
public List<Merger> bindMerger() {
List<Merger> merger = Lists.newLinkedList();
merger.add(new JSONMerger(JSONMERGE, false));
merger.add(new JSONMerger(JSONMERGE_OVERRIDE, true));
return merger;
}
use of com.devonfw.cobigen.api.extension.Merger in project cobigen by devonfw.
the class TypeScriptMergerTest method testMergingMassiveFile.
/**
* We need to test whether we are able to send large amount of data to the server.
*/
@Test
public void testMergingMassiveFile() {
// arrange
Merger tsMerger = this.activator.bindMerger().stream().filter(e -> e.getType().equals(TypeScriptPluginActivator.TSMERGE)).findFirst().get();
File baseFile = new File(testFileRootPath + "massiveFile.ts");
// act
String mergedContents = tsMerger.merge(baseFile, readTSFile("patchFile.ts"), "UTF-8");
assertEquals(false, mergedContents.contains("Not able to merge") || mergedContents.isEmpty());
}
use of com.devonfw.cobigen.api.extension.Merger in project cobigen by devonfw.
the class TypeScriptMergerTest method testMergingNoOverrides.
/**
* Checks if the ts-merger can be launched and if the output is correct with patchOverrides = false
*/
@Test
public void testMergingNoOverrides() {
// arrange
Merger tsMerger = this.activator.bindMerger().stream().filter(e -> e.getType().equals(TypeScriptPluginActivator.TSMERGE)).findFirst().get();
File baseFile = new File(testFileRootPath + "baseFile.ts");
// Should merge comments
String regex = " * Should format correctly this line";
// act
String mergedContents = tsMerger.merge(baseFile, readTSFile("patchFile.ts"), "UTF-8");
assertThat(mergedContents).contains("bProperty");
assertThat(mergedContents).contains("aProperty: number = 2");
assertThat(mergedContents).contains("bMethod");
assertThat(mergedContents).contains("aMethod");
assertThat(mergedContents).contains("bProperty");
assertThat(mergedContents).contains("import { c, f } from 'd'");
assertThat(mergedContents).contains("import { a, e } from 'b'");
assertThat(mergedContents).contains("export { e, g } from 'f';");
assertThat(mergedContents).contains("export interface a {");
assertThat(mergedContents).contains("private b: number;");
assertThat(mergedContents).containsPattern(regex);
mergedContents = tsMerger.merge(baseFile, readTSFile("patchFile.ts"), "ISO-8859-1");
assertThat(mergedContents).contains("bProperty");
assertThat(mergedContents).contains("aProperty: number = 2");
assertThat(mergedContents).contains("bMethod");
assertThat(mergedContents).contains("aMethod");
assertThat(mergedContents).contains("bProperty");
assertThat(mergedContents).contains("import { c, f } from 'd'");
assertThat(mergedContents).contains("import { a, e } from 'b'");
assertThat(mergedContents).contains("export { e, g } from 'f';");
assertThat(mergedContents).contains("export interface a {");
assertThat(mergedContents).contains("private b: number;");
assertThat(mergedContents).containsPattern(regex);
}
Aggregations