Search in sources :

Example 1 with MetadataSerializableImpl

use of org.eclipse.tycho.p2.impl.repo.MetadataSerializableImpl in project tycho by eclipse.

the class MetadataSerializableImplTest method testSerializeAndLoad.

@Test
public void testSerializeAndLoad() throws IOException, ProvisionException, OperationCanceledException {
    File tmpDir = createTempDir("repo");
    try {
        Set<IInstallableUnit> units = new HashSet<>(Arrays.asList(InstallableUnitUtil.createIU("org.example.test", "1.0.0")));
        MetadataSerializableImpl subject = new MetadataSerializableImpl();
        serialize(subject, units, tmpDir);
        Assert.assertEquals(units, deserialize(tmpDir));
    } finally {
        deleteRecursive(tmpDir);
    }
}
Also used : MetadataSerializableImpl(org.eclipse.tycho.p2.impl.repo.MetadataSerializableImpl) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) File(java.io.File) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with MetadataSerializableImpl

use of org.eclipse.tycho.p2.impl.repo.MetadataSerializableImpl in project tycho by eclipse.

the class MetadataSerializableImplTest method testSerializeAndLoadWithEmptyIUList.

@Test
public void testSerializeAndLoadWithEmptyIUList() throws IOException, ProvisionException, OperationCanceledException {
    File tmpDir = createTempDir("repo");
    try {
        Set<IInstallableUnit> units = new HashSet<>();
        MetadataSerializableImpl subject = new MetadataSerializableImpl();
        serialize(subject, units, tmpDir);
        Assert.assertEquals(units, deserialize(tmpDir));
    } finally {
        deleteRecursive(tmpDir);
    }
}
Also used : MetadataSerializableImpl(org.eclipse.tycho.p2.impl.repo.MetadataSerializableImpl) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) File(java.io.File) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

File (java.io.File)2 HashSet (java.util.HashSet)2 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)2 MetadataSerializableImpl (org.eclipse.tycho.p2.impl.repo.MetadataSerializableImpl)2 Test (org.junit.Test)2