Search in sources :

Example 11 with AddonSpecification

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);
}
Also used : AddonSpecification(org.openecard.addon.manifest.AddonSpecification)

Example 12 with AddonSpecification

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());
}
Also used : AddonSpecification(org.openecard.addon.manifest.AddonSpecification) HashSet(java.util.HashSet) Test(org.testng.annotations.Test)

Example 13 with AddonSpecification

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());
}
Also used : AddonSpecification(org.openecard.addon.manifest.AddonSpecification) HashSet(java.util.HashSet) Test(org.testng.annotations.Test)

Example 14 with AddonSpecification

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());
}
Also used : AddonSpecification(org.openecard.addon.manifest.AddonSpecification) HashSet(java.util.HashSet) Test(org.testng.annotations.Test)

Example 15 with AddonSpecification

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);
}
Also used : AddonSpecification(org.openecard.addon.manifest.AddonSpecification) Test(org.testng.annotations.Test)

Aggregations

AddonSpecification (org.openecard.addon.manifest.AddonSpecification)37 Test (org.testng.annotations.Test)21 AppPluginActionProxy (org.openecard.addon.bind.AppPluginActionProxy)5 IOException (java.io.IOException)4 HashSet (java.util.HashSet)4 AppExtensionAction (org.openecard.addon.bind.AppExtensionAction)4 AppExtensionActionProxy (org.openecard.addon.bind.AppExtensionActionProxy)3 AppPluginAction (org.openecard.addon.bind.AppPluginAction)3 GridBagConstraints (java.awt.GridBagConstraints)2 Insets (java.awt.Insets)2 ArrayList (java.util.ArrayList)2 TreeSet (java.util.TreeSet)2 JLabel (javax.swing.JLabel)2 JList (javax.swing.JList)2 AddonRegistry (org.openecard.addon.AddonRegistry)2 IFDProtocolProxy (org.openecard.addon.ifd.IFDProtocolProxy)2 ProtocolPluginSpecification (org.openecard.addon.manifest.ProtocolPluginSpecification)2 SALProtocolProxy (org.openecard.addon.sal.SALProtocolProxy)2 InitializeFramework (de.bund.bsi.ecard.api._1.InitializeFramework)1 ApplicationCapabilitiesType (iso.std.iso_iec._24727.tech.schema.ApplicationCapabilitiesType)1