@Test(groups = "fast") public void testBuildPluginProperties() throws Exception { Assert.assertEquals(pluginProperties1.size(), 2); Assert.assertEquals(pluginProperties1.get(0).getKey(), "foo"); Assert.assertEquals(pluginProperties1.get(0).getValue(), "bar"); Assert.assertFalse(pluginProperties1.get(0).getIsUpdatable()); Assert.assertEquals(pluginProperties1.get(1).getKey(), "baz"); Assert.assertEquals(pluginProperties1.get(1).getValue(), (Long) 12L); Assert.assertFalse(pluginProperties1.get(1).getIsUpdatable()); }
@Test(groups = "fast") public void testMerge() throws Exception { final List<PluginProperty> pluginPropertiesRaw = ImmutableList.<PluginProperty>copyOf(PluginProperties.merge(pluginProperties1, pluginProperties2)); final List<PluginProperty> pluginProperties = sort(pluginPropertiesRaw); Assert.assertEquals(pluginProperties.size(), 3); Assert.assertEquals(pluginProperties.get(0).getKey(), "baz"); Assert.assertEquals(pluginProperties.get(0).getValue(), (Long) 12L); Assert.assertFalse(pluginProperties.get(0).getIsUpdatable()); Assert.assertEquals(pluginProperties.get(1).getKey(), "baz2"); Assert.assertEquals(pluginProperties.get(1).getValue(), "something else"); Assert.assertFalse(pluginProperties.get(1).getIsUpdatable()); Assert.assertEquals(pluginProperties.get(2).getKey(), "foo"); Assert.assertEquals(pluginProperties.get(2).getValue(), "override"); Assert.assertFalse(pluginProperties.get(2).getIsUpdatable()); }
public PluginPropertyJson(final PluginProperty pluginProperty) { this(pluginProperty.getKey(), pluginProperty.getValue() == null ? null : pluginProperty.getValue().toString(), pluginProperty.getIsUpdatable()); }
@Override public PluginPropertyJson apply(final PluginProperty input) { return new PluginPropertyJson(input.getKey(), input.getValue() == null ? null : input.getValue().toString(), input.getIsUpdatable()); } }));
@Test(groups = "fast") public void testBuildPluginProperties() throws Exception { Assert.assertEquals(pluginProperties1.size(), 2); Assert.assertEquals(pluginProperties1.get(0).getKey(), "foo"); Assert.assertEquals(pluginProperties1.get(0).getValue(), "bar"); Assert.assertFalse(pluginProperties1.get(0).getIsUpdatable()); Assert.assertEquals(pluginProperties1.get(1).getKey(), "baz"); Assert.assertEquals(pluginProperties1.get(1).getValue(), (Long) 12L); Assert.assertFalse(pluginProperties1.get(1).getIsUpdatable()); }
@Test(groups = "fast") public void testBuildPluginProperties() throws Exception { Assert.assertEquals(pluginProperties1.size(), 2); Assert.assertEquals(pluginProperties1.get(0).getKey(), "foo"); Assert.assertEquals(pluginProperties1.get(0).getValue(), "bar"); Assert.assertFalse(pluginProperties1.get(0).getIsUpdatable()); Assert.assertEquals(pluginProperties1.get(1).getKey(), "baz"); Assert.assertEquals(pluginProperties1.get(1).getValue(), (Long) 12L); Assert.assertFalse(pluginProperties1.get(1).getIsUpdatable()); }
@Test(groups = "fast") public void testMerge() throws Exception { final List<PluginProperty> pluginPropertiesRaw = ImmutableList.<PluginProperty>copyOf(PluginProperties.merge(pluginProperties1, pluginProperties2)); final List<PluginProperty> pluginProperties = sort(pluginPropertiesRaw); Assert.assertEquals(pluginProperties.size(), 3); Assert.assertEquals(pluginProperties.get(0).getKey(), "baz"); Assert.assertEquals(pluginProperties.get(0).getValue(), (Long) 12L); Assert.assertFalse(pluginProperties.get(0).getIsUpdatable()); Assert.assertEquals(pluginProperties.get(1).getKey(), "baz2"); Assert.assertEquals(pluginProperties.get(1).getValue(), "something else"); Assert.assertFalse(pluginProperties.get(1).getIsUpdatable()); Assert.assertEquals(pluginProperties.get(2).getKey(), "foo"); Assert.assertEquals(pluginProperties.get(2).getValue(), "override"); Assert.assertFalse(pluginProperties.get(2).getIsUpdatable()); }
@Test(groups = "fast") public void testMerge() throws Exception { final List<PluginProperty> pluginPropertiesRaw = ImmutableList.<PluginProperty>copyOf(PluginProperties.merge(pluginProperties1, pluginProperties2)); final List<PluginProperty> pluginProperties = sort(pluginPropertiesRaw); Assert.assertEquals(pluginProperties.size(), 3); Assert.assertEquals(pluginProperties.get(0).getKey(), "baz"); Assert.assertEquals(pluginProperties.get(0).getValue(), (Long) 12L); Assert.assertFalse(pluginProperties.get(0).getIsUpdatable()); Assert.assertEquals(pluginProperties.get(1).getKey(), "baz2"); Assert.assertEquals(pluginProperties.get(1).getValue(), "something else"); Assert.assertFalse(pluginProperties.get(1).getIsUpdatable()); Assert.assertEquals(pluginProperties.get(2).getKey(), "foo"); Assert.assertEquals(pluginProperties.get(2).getValue(), "override"); Assert.assertFalse(pluginProperties.get(2).getIsUpdatable()); final List<PluginProperty> pluginPropertiesRaw2 = ImmutableList.<PluginProperty>copyOf(PluginProperties.merge(PluginProperties.toMap(pluginProperties1), pluginProperties2)); Assert.assertEquals(sort(pluginPropertiesRaw2), pluginProperties); final List<PluginProperty> pluginPropertiesRaw3 = ImmutableList.<PluginProperty>copyOf(PluginProperties.merge(PluginProperties.toMap(pluginProperties1), pluginProperties1, pluginProperties2)); Assert.assertEquals(sort(pluginPropertiesRaw3), pluginProperties); final List<PluginProperty> pluginPropertiesRaw4 = ImmutableList.<PluginProperty>copyOf(PluginProperties.merge(ImmutableMap.<String, Object>of(), pluginProperties1, pluginProperties2)); Assert.assertEquals(sort(pluginPropertiesRaw4), pluginProperties); final List<PluginProperty> pluginPropertiesRaw5 = ImmutableList.<PluginProperty>copyOf(PluginProperties.merge((Map) null, pluginProperties1, pluginProperties2)); Assert.assertEquals(sort(pluginPropertiesRaw5), pluginProperties); }