Search in sources :

Example 31 with AddonSpecification

use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.

the class CacheTest method addSALProtocol.

@Test
public void addSALProtocol() {
    SALProtocolProxy proxy = new SALProtocolProxy(null, null);
    int initialHash = proxy.hashCode();
    AddonSpecification spec = new AddonSpecification();
    String id = "test";
    spec.setId(id);
    spec.setVersion("1.0.0");
    cache.addSALProtocol(spec, id, proxy);
    // now get it back from the cache
    SALProtocol proto = cache.getSALProtocol(spec, id);
    Assert.assertEquals(proto.hashCode(), initialHash);
}
Also used : SALProtocol(org.openecard.addon.sal.SALProtocol) SALProtocolProxy(org.openecard.addon.sal.SALProtocolProxy) AddonSpecification(org.openecard.addon.manifest.AddonSpecification) Test(org.testng.annotations.Test)

Example 32 with AddonSpecification

use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.

the class CacheTest method addAppPluginAction.

@Test
public void addAppPluginAction() {
    AppPluginActionProxy proxy = new AppPluginActionProxy(null, null);
    int initialHash = proxy.hashCode();
    AddonSpecification spec = new AddonSpecification();
    String id = "test";
    spec.setId(id);
    spec.setVersion("1.0.0");
    cache.addAppPluginAction(spec, id, proxy);
    // now get it back from the cache
    AppPluginAction proto = cache.getAppPluginAction(spec, id);
    Assert.assertEquals(proto.hashCode(), initialHash);
}
Also used : AppPluginActionProxy(org.openecard.addon.bind.AppPluginActionProxy) AddonSpecification(org.openecard.addon.manifest.AddonSpecification) AppPluginAction(org.openecard.addon.bind.AppPluginAction) Test(org.testng.annotations.Test)

Example 33 with AddonSpecification

use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.

the class CacheTest method removeMulti.

@Test
public void removeMulti() {
    SALProtocolProxy proxy4 = new SALProtocolProxy(null, null);
    AddonSpecification spec4 = new AddonSpecification();
    String id4 = "test4";
    spec4.setId(id4);
    spec4.setVersion("1.0.0");
    cache.addSALProtocol(spec4, id4, proxy4);
    IFDProtocolProxy proxy3 = new IFDProtocolProxy(null, null);
    AddonSpecification spec2 = new AddonSpecification();
    String id1 = "test1";
    spec2.setId(id1);
    spec2.setVersion("1.0.0");
    cache.addIFDProtocol(spec2, id1, proxy3);
    AppPluginActionProxy proxy = new AppPluginActionProxy(null, null);
    AddonSpecification spec1 = new AddonSpecification();
    String id0 = "test2";
    spec1.setId(id0);
    spec1.setVersion("1.0.0");
    cache.addAppPluginAction(spec1, id0, proxy);
    AppExtensionActionProxy proxy2 = new AppExtensionActionProxy(null, null);
    AddonSpecification spec = new AddonSpecification();
    String id = "test";
    spec.setId(id);
    spec.setVersion("1.0.0");
    cache.addAppExtensionAction(spec, id, proxy2);
    cache.removeCacheEntry(spec, id);
    cache.removeCacheEntry(spec1, id0);
    // now get it back from the cache
    AppExtensionAction proto = cache.getAppExtensionAction(spec, id);
    AppPluginAction action = cache.getAppPluginAction(spec1, id0);
    Assert.assertNull(proto);
    Assert.assertNull(action);
}
Also used : AppExtensionAction(org.openecard.addon.bind.AppExtensionAction) AppPluginActionProxy(org.openecard.addon.bind.AppPluginActionProxy) IFDProtocolProxy(org.openecard.addon.ifd.IFDProtocolProxy) SALProtocolProxy(org.openecard.addon.sal.SALProtocolProxy) AddonSpecification(org.openecard.addon.manifest.AddonSpecification) AppExtensionActionProxy(org.openecard.addon.bind.AppExtensionActionProxy) AppPluginAction(org.openecard.addon.bind.AppPluginAction) Test(org.testng.annotations.Test)

Example 34 with AddonSpecification

use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.

the class CacheTest method removeSingle.

@Test
public void removeSingle() {
    AppPluginActionProxy proxy = new AppPluginActionProxy(null, null);
    AddonSpecification spec = new AddonSpecification();
    String id = "test";
    spec.setId(id);
    spec.setVersion("1.0.0");
    cache.addAppPluginAction(spec, id, proxy);
    // now get it back from the cache
    cache.removeCacheEntry(spec, id);
    AppPluginAction action = cache.getAppPluginAction(spec, id);
    Assert.assertNull(action);
}
Also used : AppPluginActionProxy(org.openecard.addon.bind.AppPluginActionProxy) AddonSpecification(org.openecard.addon.manifest.AddonSpecification) AppPluginAction(org.openecard.addon.bind.AppPluginAction) Test(org.testng.annotations.Test)

Example 35 with AddonSpecification

use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.

the class HighestVersionSelectorTest method testLexicalVersioning.

/**
 * Test pure alphabetical versions.
 */
@Test
public void testLexicalVersioning() {
    AddonSpecification spec1 = new AddonSpecification();
    spec1.setVersion("moonshine release");
    spec1.setId("Test");
    AddonSpecification spec2 = new AddonSpecification();
    spec2.setVersion("alpha");
    spec2.setId("Test");
    AddonSpecification spec3 = new AddonSpecification();
    spec3.setVersion("zeta");
    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());
}
Also used : AddonSpecification(org.openecard.addon.manifest.AddonSpecification) HashSet(java.util.HashSet) 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