@Test public void describeDataSourceWithPoolPropertiesShowsItInTheResult() { binding.setType(DATASOURCE_TYPE.POOLED.getType()); List<ConfigProperty> configProperties = binding.getConfigProperties(); configProperties.add(new ConfigProperty("name1", "value1")); configProperties.add(new ConfigProperty("name2", "value2")); ResultModel result = command.describeDataSource(DATA_SOURCE_NAME); TabularResultModel section = result.getTableSection(DescribeDataSourceCommand.DATA_SOURCE_PROPERTIES_SECTION); assertThat(section.getValuesInRow(5)).isEqualTo(Arrays.asList("name1", "value1")); assertThat(section.getValuesInRow(6)).isEqualTo(Arrays.asList("name2", "value2")); }
@Test public void describeDataSourceWithPoolPropertiesDoesNotShowsItInTheResult() { binding.setType(DATASOURCE_TYPE.SIMPLE.getType()); List<ConfigProperty> configProperties = binding.getConfigProperties(); configProperties.add(new ConfigProperty("name1", "value1")); ResultModel result = command.describeDataSource(DATA_SOURCE_NAME); assertThat(result.toString()).doesNotContain("name1"); assertThat(result.toString()).doesNotContain("value1"); }
@Test public void jndiBindings() { service.updateCacheConfig("cluster", cacheConfig -> { JndiBindingsType.JndiBinding jndiBinding = new JndiBindingsType.JndiBinding(); jndiBinding.setJndiName("jndiOne"); jndiBinding.setJdbcDriverClass("com.sun.ABC"); jndiBinding.setType("SimpleDataSource"); jndiBinding.getConfigProperties() .add(new JndiBindingsType.JndiBinding.ConfigProperty("test", "test", "test")); cacheConfig.getJndiBindings().add(jndiBinding); return cacheConfig; }); assertThat(configuration.getCacheXmlContent()).containsOnlyOnce("</jndi-bindings>"); assertThat(configuration.getCacheXmlContent()).contains( "<jndi-binding jdbc-driver-class=\"com.sun.ABC\" jndi-name=\"jndiOne\" type=\"SimpleDataSource\">"); assertThat(configuration.getCacheXmlContent()) .contains("config-property-name>test</config-property-name>"); }
String propName = dataSourceProperty.getName(); String propValue = dataSourceProperty.getValue(); configProperties.add(new ConfigProperty(propName, "type", propValue));