Search in sources :

Example 1 with ConfigType

use of com.sequenceiq.ambari.shell.completion.ConfigType in project ambari-shell by sequenceiq.

the class ConfigCommandsTest method testSetConfigForFile.

@Test
public void testSetConfigForFile() throws IOException {
    ConfigType configType = mock(ConfigType.class);
    File file = new File("src/test/resources/core-site.xml");
    when(configType.getName()).thenReturn(CORE_SITE);
    configCommands.setConfig(configType, "", file);
    Map<String, String> config = new HashMap<String, String>();
    config.put("fs.trash.interval", "350");
    config.put("ipc.client.connection.maxidletime", "30000");
    verify(client).modifyConfiguration(CORE_SITE, config);
}
Also used : HashMap(java.util.HashMap) Matchers.anyString(org.mockito.Matchers.anyString) ConfigType(com.sequenceiq.ambari.shell.completion.ConfigType) File(java.io.File) Test(org.junit.Test)

Example 2 with ConfigType

use of com.sequenceiq.ambari.shell.completion.ConfigType in project ambari-shell by sequenceiq.

the class ConfigCommandsTest method testShowConfig.

@Test
public void testShowConfig() {
    ConfigType configType = mock(ConfigType.class);
    Map<String, Map<String, String>> mockResult = mock(Map.class);
    when(configType.getName()).thenReturn(CORE_SITE);
    when(client.getServiceConfigMap(anyString())).thenReturn(mockResult);
    when(mockResult.get(CORE_SITE)).thenReturn(new HashMap<String, String>());
    configCommands.showConfig(configType);
    verify(client).getServiceConfigMap(CORE_SITE);
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) ConfigType(com.sequenceiq.ambari.shell.completion.ConfigType) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.junit.Test)

Example 3 with ConfigType

use of com.sequenceiq.ambari.shell.completion.ConfigType in project ambari-shell by sequenceiq.

the class ConfigCommandsTest method testModifyConfig.

@Test
public void testModifyConfig() throws IOException {
    ConfigType configType = mock(ConfigType.class);
    Map<String, Map<String, String>> mockResult = mock(Map.class);
    Map<String, String> config = new HashMap<String, String>();
    config.put("fs.trash.interval", "350");
    config.put("ipc.client.connection.maxidletime", "30000");
    when(configType.getName()).thenReturn(CORE_SITE);
    when(mockResult.get(CORE_SITE)).thenReturn(config);
    when(client.getServiceConfigMap(CORE_SITE)).thenReturn(mockResult);
    configCommands.modifyConfig(configType, "fs.trash.interval", "510");
    Map<String, String> config2 = new HashMap<String, String>();
    config2.put("fs.trash.interval", "510");
    config2.put("ipc.client.connection.maxidletime", "30000");
    verify(client).modifyConfiguration(CORE_SITE, config2);
}
Also used : HashMap(java.util.HashMap) Matchers.anyString(org.mockito.Matchers.anyString) ConfigType(com.sequenceiq.ambari.shell.completion.ConfigType) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.junit.Test)

Aggregations

ConfigType (com.sequenceiq.ambari.shell.completion.ConfigType)3 HashMap (java.util.HashMap)3 Test (org.junit.Test)3 Matchers.anyString (org.mockito.Matchers.anyString)3 Map (java.util.Map)2 File (java.io.File)1