Package org.candlepin.model

Examples of org.candlepin.model.ExporterMetadataCurator


    @Test
    public void testImportRecordDeleteWithLogging()
        throws IOException, ImporterException {
        EventSink es = mock(EventSink.class);
        ExporterMetadataCurator ec = mock(ExporterMetadataCurator.class);
        SubscriptionCurator sc = mock(SubscriptionCurator.class);
        OwnerResource thisOwnerResource = new OwnerResource(ownerCurator, sc,
            null, null, null, i18n, es, null, null, null, null, null, ec,
            null, importRecordCurator, null, null, null, null, null,
            null, null, null, contentOverrideValidator,
            serviceLevelValidator, null);

        ExporterMetadata metadata = new ExporterMetadata();
        when(ec.lookupByTypeAndOwner(ExporterMetadata.TYPE_PER_USER, owner))
            .thenReturn(metadata);
        when(sc.listByOwner(owner)).thenReturn(new ArrayList<Subscription>());

        thisOwnerResource.undoImports(owner.getKey(),
            new UserPrincipal("JarJarBinks", null, true));
View Full Code Here


        Date now = new Date();
        File file = createFile("meta", "0.0.3", now,
            "test_user", "prefix");
        File actual = createFile("meta.json", "0.0.3", now,
            "test_user", "prefix");
        ExporterMetadataCurator emc = mock(ExporterMetadataCurator.class);
        ExporterMetadata em = new ExporterMetadata();
        Date daybefore = getDateBeforeDays(1);
        em.setExported(daybefore);
        em.setId("42");
        em.setType(ExporterMetadata.TYPE_SYSTEM);
        when(emc.lookupByType(ExporterMetadata.TYPE_SYSTEM)).thenReturn(em);
        Importer i = new Importer(null, null, null, null, null, null, null,
            null, null, null, emc, null, null, i18n, null, null);
        i.validateMetadata(ExporterMetadata.TYPE_SYSTEM, null, actual,
            new ConflictOverrides());
View Full Code Here

    public void firstRun() throws Exception {
        File f = createFile("meta", "0.0.3", new Date(),
            "test_user", "prefix");
        File actualmeta = createFile("meta.json", "0.0.3", new Date(),
            "test_user", "prefix");
        ExporterMetadataCurator emc = mock(ExporterMetadataCurator.class);
        when(emc.lookupByType(ExporterMetadata.TYPE_SYSTEM)).thenReturn(null);
        Importer i = new Importer(null, null, null, null, null, null, null,
            null, null, null, emc, null, null, i18n, null, null);
        i.validateMetadata(ExporterMetadata.TYPE_SYSTEM, null, actualmeta,
            new ConflictOverrides());
        assertTrue(f.delete());
View Full Code Here

    @Test
    public void oldImport() throws Exception {
        // actualmeta is the mock for the import itself
        File actualmeta = createFile("meta.json", "0.0.3", getDateBeforeDays(10),
            "test_user", "prefix");
        ExporterMetadataCurator emc = mock(ExporterMetadataCurator.class);
        // emc is the mock for lastrun (i.e., the most recent import in CP)
        ExporterMetadata em = new ExporterMetadata();
        em.setExported(getDateBeforeDays(3));
        em.setId("42");
        em.setType(ExporterMetadata.TYPE_SYSTEM);
        when(emc.lookupByType(ExporterMetadata.TYPE_SYSTEM)).thenReturn(em);
        Importer i = new Importer(null, null, null, null, null, null, null,
            null, null, null, emc, null, null, i18n, null, null);
        try {
            i.validateMetadata(ExporterMetadata.TYPE_SYSTEM, null, actualmeta,
                new ConflictOverrides());
View Full Code Here

    public void sameImport() throws Exception {
        // actualmeta is the mock for the import itself
        Date date = getDateBeforeDays(10);
        File actualmeta = createFile("meta.json", "0.0.3", date,
            "test_user", "prefix");
        ExporterMetadataCurator emc = mock(ExporterMetadataCurator.class);
        // emc is the mock for lastrun (i.e., the most recent import in CP)
        ExporterMetadata em = new ExporterMetadata();
        em.setExported(date); // exact same date = assumed same manifest
        em.setId("42");
        em.setType(ExporterMetadata.TYPE_SYSTEM);
        when(emc.lookupByType(ExporterMetadata.TYPE_SYSTEM)).thenReturn(em);
        Importer i = new Importer(null, null, null, null, null, null, null,
            null, null, null, emc, null, null, i18n, null, null);
        try {
            i.validateMetadata(ExporterMetadata.TYPE_SYSTEM, null, actualmeta,
                new ConflictOverrides());
View Full Code Here

        // this tests bz #790751
        Date importDate = getDateBeforeDays(10);
        // actualmeta is the mock for the import itself
        File actualmeta = createFile("meta.json", "0.0.3", importDate,
            "test_user", "prefix");
        ExporterMetadataCurator emc = mock(ExporterMetadataCurator.class);
        // em is the mock for lastrun (i.e., the most recent import in CP)
        ExporterMetadata em = new ExporterMetadata();
        em.setExported(getDateBeforeDays(30));
        em.setId("42");
        em.setType(ExporterMetadata.TYPE_SYSTEM);
        when(emc.lookupByType(ExporterMetadata.TYPE_SYSTEM)).thenReturn(em);
        Importer i = new Importer(null, null, null, null, null, null, null,
            null, null, null, emc, null, null, i18n, null, null);
        i.validateMetadata(ExporterMetadata.TYPE_SYSTEM, null, actualmeta,
            new ConflictOverrides());
        assertEquals(importDate, em.getExported());
View Full Code Here

    @Test(expected = ImporterException.class)
    public void expectOwner() throws ImporterException, IOException {
        File actualmeta = createFile("meta.json", "0.0.3", new Date(),
            "test_user", "prefix");
        ExporterMetadataCurator emc = mock(ExporterMetadataCurator.class);
        when(emc.lookupByTypeAndOwner(ExporterMetadata.TYPE_PER_USER, null))
            .thenReturn(null);
        Importer i = new Importer(null, null, null, null, null, null, null,
            null, null, null, emc, null, null, i18n, null, null);

        // null Type should cause exception
View Full Code Here

    @Test
    public void testImportNoDistributorVersions()
        throws IOException, ImporterException {
        RulesImporter ri = mock(RulesImporter.class);
        ExporterMetadataCurator emc = mock(ExporterMetadataCurator.class);
        Importer i = new Importer(null, null, ri, null, null, null, null,
            null, null, config, emc, null, null, i18n, null, null);
        Owner owner = mock(Owner.class);
        ConflictOverrides co = mock(ConflictOverrides.class);
        Map<String, File> importFiles = getTestImportFiles();
View Full Code Here

TOP

Related Classes of org.candlepin.model.ExporterMetadataCurator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.