Search in sources :

Example 1 with FileNode

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

the class FileSenderTest method require_that_null_files_are_not_sent.

@Test(expected = IllegalArgumentException.class)
public void require_that_null_files_are_not_sent() {
    def.addFileDef("fileVal");
    service.pathToRef.put("foo.txt", new FileNode("fooshash").value());
    FileSender.sendUserConfiguredFiles(producer, serviceList, new BaseDeployLogger());
}
Also used : BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) FileNode(com.yahoo.config.FileNode) Test(org.junit.Test)

Example 2 with FileNode

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

the class FileSenderTest method require_that_fields_in_inner_maps_are_modified.

@Test
public void require_that_fields_in_inner_maps_are_modified() {
    def.structMapDef("inner").addFileDef("fileVal");
    def.structMapDef("inner").addStringDef("stringVal");
    ConfigPayloadBuilder inner = builder.getMap("inner").put("foo");
    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.getMap("inner").get("foo").getObject("fileVal").getValue(), is("barhash"));
    assertThat(builder.getMap("inner").get("foo").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 3 with FileNode

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

the class FileSenderTest method require_that_structs_are_modified.

@Test
public void require_that_structs_are_modified() {
    def.structDef("struct").addFileDef("fileVal");
    def.structDef("struct").addStringDef("stringVal");
    builder.getObject("struct").setField("fileVal", "foo.txt");
    builder.getObject("struct").setField("stringVal", "foo.txt");
    service.pathToRef.put("foo.txt", new FileNode("foohash").value());
    FileSender.sendUserConfiguredFiles(producer, serviceList, new BaseDeployLogger());
    assertThat(builder.getObject("struct").getObject("fileVal").getValue(), is("foohash"));
    assertThat(builder.getObject("struct").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 4 with FileNode

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

the class FileSenderTest method require_that_simple_file_fields_are_modified.

@Test
public void require_that_simple_file_fields_are_modified() {
    def.addFileDef("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 5 with FileNode

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

the class FileSenderTest method require_that_arrays_are_modified.

@Test
public void require_that_arrays_are_modified() {
    def.arrayDef("fileArray").setTypeSpec(new ConfigDefinition.TypeSpec("fileArray", "file", null, null, null, null));
    def.arrayDef("pathArray").setTypeSpec(new ConfigDefinition.TypeSpec("pathArray", "path", null, null, null, null));
    def.arrayDef("stringArray").setTypeSpec(new ConfigDefinition.TypeSpec("stringArray", "string", null, null, null, null));
    builder.getArray("fileArray").append("foo.txt");
    builder.getArray("fileArray").append("bar.txt");
    builder.getArray("pathArray").append("path.txt");
    builder.getArray("stringArray").append("foo.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.getArray("fileArray").get(0).getValue(), is("foohash"));
    assertThat(builder.getArray("fileArray").get(1).getValue(), is("barhash"));
    assertThat(builder.getArray("pathArray").get(0).getValue(), is("pathhash"));
    assertThat(builder.getArray("stringArray").get(0).getValue(), is("foo.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