use of org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceInfo in project epp.mpc by eclipse.
the class MarketplaceInfoSerializationTest method loadMarketplaceInfo.
private MarketplaceInfo loadMarketplaceInfo() {
MarketplaceInfo cleanInfo = new TestMarketplaceInfo();
assertTrue(cleanInfo.getIuToNodeKey().isEmpty());
assertTrue(cleanInfo.getNodeKeyToIU().isEmpty());
MarketplaceInfo loaded = cleanInfo.load();
return loaded;
}
use of org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceInfo in project epp.mpc by eclipse.
the class MarketplaceInfoSerializationTest method loadGarbage.
@Test
public void loadGarbage() throws Exception {
createEmptyRegistryFile(getUserHomeRegistryFile());
FileOutputStream os = new FileOutputStream(getUserHomeRegistryFile());
os.write(new byte[] { (byte) 0x31, (byte) 0xcc, (byte) 0x2a, (byte) 0x99, (byte) 0x84, (byte) 0xc2, (byte) 0x5a, (byte) 0xe2, (byte) 0xd6, (byte) 0xc8, (byte) 0xbb, (byte) 0x46, (byte) 0x67, (byte) 0xbb, (byte) 0x5d, (byte) 0x63, (byte) 0x2f, (byte) 0x16, (byte) 0x68, (byte) 0xf1, (byte) 0x09, (byte) 0xf4, (byte) 0x35, (byte) 0x92 });
os.close();
MarketplaceInfo loaded = loadMarketplaceInfo();
assertNull(loaded);
assertFalse(MessageFormat.format("Corrupted registry file ''{0}'' was not deleted", getUserHomeRegistryFile().getAbsolutePath()), getUserHomeRegistryFile().exists());
}
use of org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceInfo in project epp.mpc by eclipse.
the class MarketplaceInfoSerializationTest method loadNonExisting.
@Test
public void loadNonExisting() {
MarketplaceInfo loaded = loadMarketplaceInfo();
assertNull(loaded);
}
use of org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceInfo in project epp.mpc by eclipse.
the class MarketplaceInfoSerializationTest method saveAndLoad.
@Test
public void saveAndLoad() throws Exception {
MarketplaceNodeCatalogItem item = MarketplaceInfoTest.createTestItem();
catalogRegistry.map(item.getMarketplaceUrl(), item.getData());
new MarketplaceInfo(catalogRegistry).save(getUserHomeRegistryFile());
File registryFile = getUserHomeRegistryFile();
assertTrue(MessageFormat.format("Registry file ''{0}'' does not exist", registryFile.getAbsolutePath()), registryFile.exists());
assertTrue(MessageFormat.format("Registry file ''{0}'' is empty", registryFile.getAbsolutePath()), registryFile.length() > 0);
MarketplaceInfo loaded = loadMarketplaceInfo();
assertNotNull(loaded);
assertFalse(loaded.getIuToNodeKey().isEmpty());
assertFalse(loaded.getNodeKeyToIU().isEmpty());
assertEquals(catalogRegistry.getIuToNodeKey(), loaded.getIuToNodeKey());
assertEquals(catalogRegistry.getNodeKeyToIU(), loaded.getNodeKeyToIU());
}
use of org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceInfo in project epp.mpc by eclipse.
the class MarketplaceInfoSerializationTest method loadIncomplete.
@Test
public void loadIncomplete() throws Exception {
File registryFile = getUserHomeRegistryFile();
copyRegistryFile(registryFile, 20);
MarketplaceInfo loaded = loadMarketplaceInfo();
assertNull(loaded);
}
Aggregations