use of com.qcadoo.plugin.api.Plugin in project qcadoo by qcadoo.
the class PluginManagmentUrlController method addGroupsToPlugins.
private Map<String, String> addGroupsToPlugins(Map<String, String> dependencies) {
Map<String, String> newDependencies = new HashMap<>();
Iterator<Map.Entry<String, String>> it = dependencies.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, String> entry = it.next();
Plugin plugin = pluginAccessor.getPlugin(entry.getKey());
String key = plugin.getPluginInformation().getGroup() + "." + plugin.getIdentifier();
newDependencies.put(key, entry.getValue());
}
return newDependencies;
}
use of com.qcadoo.plugin.api.Plugin in project qcadoo by qcadoo.
the class PluginTest method shouldHaveInformation.
@Test
public void shouldHaveInformation() throws Exception {
// given
Plugin plugin = DefaultPlugin.Builder.identifier("identifier1", Collections.<ModuleFactory<?>>emptyList()).withDescription("description").withName("name").withVendor("vendor").withVendorUrl("vendorUrl").build();
// then
assertEquals("description", plugin.getPluginInformation().getDescription());
assertEquals("name", plugin.getPluginInformation().getName());
assertEquals("vendor", plugin.getPluginInformation().getVendor());
assertEquals("vendorUrl", plugin.getPluginInformation().getVendorUrl());
}
use of com.qcadoo.plugin.api.Plugin in project qcadoo by qcadoo.
the class PluginTest method shouldHaveUnknownStateByDefault.
@Test
public void shouldHaveUnknownStateByDefault() throws Exception {
// given
Plugin plugin = DefaultPlugin.Builder.identifier("identifier", Collections.<ModuleFactory<?>>emptyList()).build();
// then
assertTrue(plugin.hasState(PluginState.UNKNOWN));
assertEquals(PluginState.UNKNOWN, plugin.getState());
}
use of com.qcadoo.plugin.api.Plugin in project qcadoo by qcadoo.
the class PluginTest method shouldCompareVersions.
@Test
public void shouldCompareVersions() throws Exception {
// given
Plugin plugin1 = DefaultPlugin.Builder.identifier("identifier", Collections.<ModuleFactory<?>>emptyList()).withVersion("2.3.4").build();
Plugin plugin2 = DefaultPlugin.Builder.identifier("identifier", Collections.<ModuleFactory<?>>emptyList()).withVersion("2.3.4").build();
Plugin plugin3 = DefaultPlugin.Builder.identifier("identifier", Collections.<ModuleFactory<?>>emptyList()).withVersion("2.3.5").build();
Plugin plugin4 = DefaultPlugin.Builder.identifier("identifier", Collections.<ModuleFactory<?>>emptyList()).withVersion("2.4.4").build();
Plugin plugin5 = DefaultPlugin.Builder.identifier("identifier", Collections.<ModuleFactory<?>>emptyList()).withVersion("3.3.4").build();
// then
assertEquals(0, plugin1.compareVersion(plugin2.getVersion()));
assertEquals(0, plugin2.compareVersion(plugin1.getVersion()));
assertEquals(-1, plugin1.compareVersion(plugin3.getVersion()));
assertEquals(-1, plugin1.compareVersion(plugin4.getVersion()));
assertEquals(-1, plugin1.compareVersion(plugin5.getVersion()));
assertEquals(-1, plugin3.compareVersion(plugin4.getVersion()));
assertEquals(-1, plugin3.compareVersion(plugin5.getVersion()));
assertEquals(-1, plugin4.compareVersion(plugin5.getVersion()));
assertEquals(1, plugin5.compareVersion(plugin1.getVersion()));
assertEquals(1, plugin5.compareVersion(plugin3.getVersion()));
assertEquals(1, plugin5.compareVersion(plugin4.getVersion()));
assertEquals(1, plugin4.compareVersion(plugin1.getVersion()));
assertEquals(1, plugin4.compareVersion(plugin3.getVersion()));
assertEquals(1, plugin3.compareVersion(plugin1.getVersion()));
}
use of com.qcadoo.plugin.api.Plugin in project qcadoo by qcadoo.
the class PluginTest method shouldHaveSystemFlag.
@Test
public void shouldHaveSystemFlag() throws Exception {
// given
Plugin plugin1 = DefaultPlugin.Builder.identifier("identifier1", Collections.<ModuleFactory<?>>emptyList()).asSystem().build();
Plugin plugin2 = DefaultPlugin.Builder.identifier("identifier1", Collections.<ModuleFactory<?>>emptyList()).build();
// then
assertTrue(plugin1.isSystemPlugin());
assertFalse(plugin2.isSystemPlugin());
}
Aggregations