blob: 244bb40b2bfe2bf6478b0d137377e819b62c14fe (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.provision.restapi;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.vespa.hosted.provision.NodeRepository;
import com.yahoo.vespa.hosted.provision.NodeRepositoryTester;
import com.yahoo.vespa.hosted.provision.applications.Application;
import org.junit.Test;
import java.io.ByteArrayInputStream;
import static org.junit.Assert.assertEquals;
/**
* @author bratseth
*/
public class ApplicationPatcherTest {
@Test
public void testPatching() {
NodeRepositoryTester tester = new NodeRepositoryTester();
Application application = Application.empty(ApplicationId.from("t1", "a1", "i1"));
tester.nodeRepository().applications().put(application, tester.nodeRepository().nodes().lock(application.id()));
String patch = "{ \"currentReadShare\" :0.4, \"maxReadShare\": 1.0 }";
ApplicationPatcher patcher = new ApplicationPatcher(new ByteArrayInputStream(patch.getBytes()),
application.id(),
tester.nodeRepository());
Application patched = patcher.apply();
assertEquals(0.4, patcher.application().status().currentReadShare(), 0.0000001);
assertEquals(1.0, patcher.application().status().maxReadShare(), 0.0000001);
patcher.close();
}
}
|