use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.
the class AddonSpecificationTest method testHashCode.
@Test
public void testHashCode() {
int versionHash = "1.0.0".hashCode();
int idHash = "ABC".hashCode();
int res = versionHash + idHash;
AddonSpecification spec1 = new AddonSpecification();
spec1.setId("ABC");
spec1.setVersion("1.0.0");
Assert.assertEquals(spec1.hashCode(), res);
}
use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.
the class AddonSpecificationTest method testEqualsSameObjectType.
@Test
public void testEqualsSameObjectType() {
AddonSpecification spec1 = new AddonSpecification();
spec1.setId("ABC");
spec1.setVersion("1.0.0");
AddonSpecification spec2 = new AddonSpecification();
spec2.setId("ABC");
spec2.setVersion("1.0.0");
Assert.assertTrue(spec1.equals(spec2));
}
use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.
the class AddonSpecificationTest method testCompareToIdEquals.
@Test
public void testCompareToIdEquals() {
AddonSpecification spec1 = new AddonSpecification();
spec1.setId("ABC");
spec1.setVersion("1.0.2");
AddonSpecification spec2 = new AddonSpecification();
spec2.setId("ABC");
spec2.setVersion("1.0.5");
Assert.assertEquals(spec1.compareTo(spec2), -1);
}
use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.
the class CacheTest method wrongGetOperation.
@Test
public void wrongGetOperation() {
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
AppExtensionAction proto = cache.getAppExtensionAction(spec, id);
Assert.assertNull(proto);
}
use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.
the class CacheTest method addWithFilledCache.
@Test
public void addWithFilledCache() {
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);
int initialHash = proxy2.hashCode();
AddonSpecification spec = new AddonSpecification();
String id = "test";
spec.setId(id);
spec.setVersion("1.0.0");
cache.addAppExtensionAction(spec, id, proxy2);
// now get it back from the cache
AppExtensionAction proto = cache.getAppExtensionAction(spec, id);
Assert.assertEquals(proto.hashCode(), initialHash);
}
Aggregations