Search in sources :

Example 1 with DistributorVersionCurator

use of org.candlepin.model.DistributorVersionCurator in project candlepin by candlepin.

the class ImporterTest method importDistributorVersionCreate.

@Test
public void importDistributorVersionCreate() throws Exception {
    DistributorVersionCurator dvc = mock(DistributorVersionCurator.class);
    Importer i = new Importer(null, null, null, null, null, null, null, null, null, null, null, null, i18n, dvc, null, su, null, this.mockSubReconciler, this.ec, this.translator);
    File[] distVer = new File[1];
    distVer[0] = new File(folder.getRoot(), "dist-ver.json");
    mapper.writeValue(distVer[0], createTestDistributerVersion());
    i.importDistributorVersions(distVer);
    verify(dvc).create(any(DistributorVersion.class));
    verify(dvc, never()).merge(any(DistributorVersion.class));
}
Also used : DistributorVersionCurator(org.candlepin.model.DistributorVersionCurator) ImportFile(org.candlepin.sync.Importer.ImportFile) File(java.io.File) DistributorVersion(org.candlepin.model.DistributorVersion) Test(org.junit.Test)

Example 2 with DistributorVersionCurator

use of org.candlepin.model.DistributorVersionCurator in project candlepin by candlepin.

the class ImporterTest method importDistributorVersionUpdate.

@Test
public void importDistributorVersionUpdate() throws Exception {
    DistributorVersionCurator dvc = mock(DistributorVersionCurator.class);
    Importer i = new Importer(null, null, null, null, null, null, null, null, null, null, null, null, i18n, dvc, null, su, null, this.mockSubReconciler, this.ec, this.translator);
    when(dvc.findByName("test-dist-ver")).thenReturn(new DistributorVersion("test-dist-ver"));
    File[] distVer = new File[1];
    distVer[0] = new File(folder.getRoot(), "dist-ver.json");
    mapper.writeValue(distVer[0], createTestDistributerVersion());
    i.importDistributorVersions(distVer);
    verify(dvc, never()).create(any(DistributorVersion.class));
    verify(dvc).merge(any(DistributorVersion.class));
}
Also used : DistributorVersionCurator(org.candlepin.model.DistributorVersionCurator) ImportFile(org.candlepin.sync.Importer.ImportFile) File(java.io.File) DistributorVersion(org.candlepin.model.DistributorVersion) Test(org.junit.Test)

Aggregations

File (java.io.File)2 DistributorVersion (org.candlepin.model.DistributorVersion)2 DistributorVersionCurator (org.candlepin.model.DistributorVersionCurator)2 ImportFile (org.candlepin.sync.Importer.ImportFile)2 Test (org.junit.Test)2