use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.
the class AddonSelector method getAppPluginAction.
public AppPluginAction getAppPluginAction(@Nonnull String resourceName) throws AddonNotFoundException {
Set<AddonSpecification> addons = manager.getRegistry().searchByResourceName(resourceName);
if (addons.isEmpty()) {
throw new AddonNotFoundException("No Add-on for resource '" + resourceName + "' found.");
}
AddonSpecification addon = strategy.select(addons);
return manager.getAppPluginAction(addon, resourceName);
}
use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.
the class HighestVersionSelectorTest method testSemanticVersioning.
/**
* Test semanticVersioning without additional string for pre release or something else.
*/
@Test
public void testSemanticVersioning() {
AddonSpecification spec1 = new AddonSpecification();
spec1.setVersion("1.0.0");
spec1.setId("Test");
AddonSpecification spec2 = new AddonSpecification();
spec2.setVersion("2.5.0");
spec2.setId("Test");
AddonSpecification spec3 = new AddonSpecification();
spec3.setVersion("0.2.1");
spec3.setId("Test");
HashSet<AddonSpecification> set = new HashSet<>();
set.add(spec3);
set.add(spec1);
set.add(spec2);
HighestVersionSelector hvs = new HighestVersionSelector();
AddonSpecification resSpec = hvs.select(set);
Assert.assertEquals(resSpec.getVersion(), spec2.getVersion());
}
use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.
the class HighestVersionSelectorTest method testLexicalAndSemanticVersioning.
/**
* Test semanticVersioninig together with lexical versioning.
*/
@Test
public void testLexicalAndSemanticVersioning() {
AddonSpecification spec1 = new AddonSpecification();
spec1.setVersion("moonshine release");
spec1.setId("Test");
AddonSpecification spec2 = new AddonSpecification();
spec2.setVersion("1.0.2");
spec2.setId("Test");
AddonSpecification spec3 = new AddonSpecification();
spec3.setVersion("1.0.2-pre1");
spec3.setId("Test");
HashSet<AddonSpecification> set1 = new HashSet<>();
set1.add(spec3);
set1.add(spec1);
set1.add(spec2);
HighestVersionSelector hvs = new HighestVersionSelector();
AddonSpecification resSpec = hvs.select(set1);
Assert.assertEquals(resSpec.getVersion(), spec2.getVersion());
}
use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.
the class HighestVersionSelectorTest method testSemanticVersioningWithAdditionalLabel.
/**
* Test semanticVersioning with additional string for pre release or something else.
*/
@Test
public void testSemanticVersioningWithAdditionalLabel() {
AddonSpecification spec1 = new AddonSpecification();
spec1.setVersion("1.0.0-alpha");
spec1.setId("Test");
AddonSpecification spec2 = new AddonSpecification();
spec2.setVersion("1.0.0-alpha.5");
spec2.setId("Test");
AddonSpecification spec3 = new AddonSpecification();
spec3.setVersion("1.0.0");
spec3.setId("Test");
HashSet<AddonSpecification> set1 = new HashSet<>();
set1.add(spec3);
set1.add(spec1);
set1.add(spec2);
HighestVersionSelector hvs = new HighestVersionSelector();
AddonSpecification resSpec = hvs.select(set1);
Assert.assertEquals(resSpec.getVersion(), spec3.getVersion());
AddonSpecification spec4 = new AddonSpecification();
spec4.setVersion("1.0.0-beta");
spec4.setId("Test");
HashSet<AddonSpecification> set2 = new HashSet<>();
set2.add(spec4);
set2.add(spec2);
set2.add(spec1);
AddonSpecification resSpec2 = hvs.select(set2);
Assert.assertEquals(resSpec2.getVersion(), spec4.getVersion());
}
use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.
the class AddonSpecificationTest method testCompareToAllDifferent.
@Test
public void testCompareToAllDifferent() {
AddonSpecification spec1 = new AddonSpecification();
spec1.setId("ABC");
spec1.setVersion("1.0.0");
AddonSpecification spec2 = new AddonSpecification();
spec2.setId("ZBD");
spec2.setVersion("1.0.8");
AddonSpecification spec3 = new AddonSpecification();
spec3.setId("ABE");
spec3.setVersion("1.0.25");
Assert.assertEquals(spec1.compareTo(spec3), -1);
Assert.assertEquals(spec1.compareTo(spec2), -1);
Assert.assertEquals(spec2.compareTo(spec3), 1);
}
Aggregations