Search in sources :

Example 6 with FileNode

use of com.yahoo.config.FileNode in project vespa by vespa-engine.

the class FileSenderTest method require_that_simple_path_fields_are_modified.

@Test
public void require_that_simple_path_fields_are_modified() {
    def.addPathDef("fileVal");
    def.addStringDef("stringVal");
    builder.setField("fileVal", "foo.txt");
    builder.setField("stringVal", "foo.txt");
    service.pathToRef.put("foo.txt", new FileNode("fooshash").value());
    FileSender.sendUserConfiguredFiles(producer, serviceList, new BaseDeployLogger());
    assertThat(builder.getObject("fileVal").getValue(), is("fooshash"));
    assertThat(builder.getObject("stringVal").getValue(), is("foo.txt"));
}
Also used : BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) FileNode(com.yahoo.config.FileNode) Test(org.junit.Test)

Example 7 with FileNode

use of com.yahoo.config.FileNode in project vespa by vespa-engine.

the class FileSenderTest method require_that_fields_in_inner_arrays_are_modified.

@Test
public void require_that_fields_in_inner_arrays_are_modified() {
    def.innerArrayDef("inner").addFileDef("fileVal");
    def.innerArrayDef("inner").addStringDef("stringVal");
    ConfigPayloadBuilder inner = builder.getArray("inner").append();
    inner.setField("fileVal", "bar.txt");
    inner.setField("stringVal", "bar.txt");
    service.pathToRef.put("bar.txt", new FileNode("barhash").value());
    FileSender.sendUserConfiguredFiles(producer, serviceList, new BaseDeployLogger());
    assertThat(builder.getArray("inner").get(0).getObject("fileVal").getValue(), is("barhash"));
    assertThat(builder.getArray("inner").get(0).getObject("stringVal").getValue(), is("bar.txt"));
}
Also used : BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) FileNode(com.yahoo.config.FileNode) Test(org.junit.Test)

Example 8 with FileNode

use of com.yahoo.config.FileNode in project vespa by vespa-engine.

the class FileSenderTest method require_that_leaf_maps_are_modified.

@Test
public void require_that_leaf_maps_are_modified() {
    def.leafMapDef("fileMap").setTypeSpec(new ConfigDefinition.TypeSpec("fileMap", "file", null, null, null, null));
    def.leafMapDef("pathMap").setTypeSpec(new ConfigDefinition.TypeSpec("pathMap", "path", null, null, null, null));
    def.leafMapDef("stringMap").setTypeSpec(new ConfigDefinition.TypeSpec("stringMap", "string", null, null, null, null));
    builder.getMap("fileMap").put("foo", "foo.txt");
    builder.getMap("fileMap").put("bar", "bar.txt");
    builder.getMap("pathMap").put("path", "path.txt");
    builder.getMap("stringMap").put("bar", "bar.txt");
    service.pathToRef.put("foo.txt", new FileNode("foohash").value());
    service.pathToRef.put("bar.txt", new FileNode("barhash").value());
    service.pathToRef.put("path.txt", new FileNode("pathhash").value());
    FileSender.sendUserConfiguredFiles(producer, serviceList, new BaseDeployLogger());
    assertThat(builder.getMap("fileMap").get("foo").getValue(), is("foohash"));
    assertThat(builder.getMap("fileMap").get("bar").getValue(), is("barhash"));
    assertThat(builder.getMap("pathMap").get("path").getValue(), is("pathhash"));
    assertThat(builder.getMap("stringMap").get("bar").getValue(), is("bar.txt"));
}
Also used : BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) FileNode(com.yahoo.config.FileNode) Test(org.junit.Test)

Aggregations

FileNode (com.yahoo.config.FileNode)8 BaseDeployLogger (com.yahoo.config.model.application.provider.BaseDeployLogger)8 Test (org.junit.Test)8