Package org.candlepin.model

Examples of org.candlepin.model.ImportRecord


    public void singleOwner() throws Exception {
        Owner owner = new Owner("owner");
        ownerCurator.create(owner);

        for (int i = 0; i < 13; i++) {
            ImportRecord record = new ImportRecord(owner);
            record.recordStatus(ImportRecord.Status.SUCCESS, "great!");

            this.importRecordCurator.create(record);
        }

        this.job.execute(null);
View Full Code Here


    public void lessThanThreshold() throws Exception {
        Owner owner = new Owner("owner");
        ownerCurator.create(owner);

        for (int i = 0; i < 7; i++) {
            ImportRecord record = new ImportRecord(owner);
            record.recordStatus(ImportRecord.Status.SUCCESS, "great!");

            this.importRecordCurator.create(record);
        }

        this.job.execute(null);
View Full Code Here

        Owner owner2 = new Owner("owner2");
        ownerCurator.create(owner1);
        ownerCurator.create(owner2);

        for (int i = 0; i < 23; i++) {
            ImportRecord record = new ImportRecord(owner1);
            record.recordStatus(ImportRecord.Status.FAILURE, "Bad bad");

            this.importRecordCurator.create(record);
        }

        for (int i = 0; i < 4; i++) {
            ImportRecord record = new ImportRecord(owner2);
            record.recordStatus(ImportRecord.Status.SUCCESS, "Excellent");

            this.importRecordCurator.create(record);
        }

        this.job.execute(null);
View Full Code Here

        when(importer.loadExport(eq(owner), any(File.class), any(ConflictOverrides.class)))
            .thenReturn(new HashMap<String, Object>());

        thisOwnerResource.importManifest(owner.getKey(), new String [] {}, input);
        List<ImportRecord> records = importRecordCurator.findRecords(owner);
        ImportRecord ir = records.get(0);
        assertEquals("test_file.zip", ir.getFileName());
        assertEquals(owner, ir.getOwner());
        assertEquals(ImportRecord.Status.SUCCESS, ir.getStatus());
    }
View Full Code Here

        thisOwnerResource.undoImports(owner.getKey(),
            new UserPrincipal("JarJarBinks", null, true));
        List<ImportRecord> records = importRecordCurator.findRecords(owner);
        assertTrue(records.size() == 1);
        ImportRecord ir = records.get(0);
        assertTrue(ir.getStatus() == ImportRecord.Status.DELETE);
    }
View Full Code Here

        }
        catch (IseException ise) {
            // expected, so we catch and go on.
        }
        List<ImportRecord> records = importRecordCurator.findRecords(owner);
        ImportRecord ir = records.get(0);
        assertEquals("test_file.zip", ir.getFileName());
        assertEquals(owner, ir.getOwner());
        assertEquals(ImportRecord.Status.FAILURE, ir.getStatus());
        assertEquals("Bad import", ir.getStatusMessage());
    }
View Full Code Here

    }

    private void recordImportSuccess(Owner owner, Map data,
        ConflictOverrides forcedConflicts, String filename) {

        ImportRecord record = new ImportRecord(owner);
        Meta meta = (Meta) data.get("meta");
        if (meta != null) {
            record.setGeneratedBy(meta.getPrincipalName());
            record.setGeneratedDate(meta.getCreated());
        }
        record.setUpstreamConsumer(createImportUpstreamConsumer(owner, null));
        record.setFileName(filename);

        String msg = i18n.tr("{0} file imported successfully.", owner.getKey());
        if (!forcedConflicts.isEmpty()) {
            msg = i18n.tr("{0} file imported forcibly", owner.getKey());
        }

        record.recordStatus(ImportRecord.Status.SUCCESS, msg);

        this.importRecordCurator.create(record);
    }
View Full Code Here

        this.importRecordCurator.create(record);
    }

    private void recordImportFailure(Owner owner, Map data, Throwable error,
        String filename) {
        ImportRecord record = new ImportRecord(owner);
        Meta meta = (Meta) data.get("meta");
        log.error("Recording import failure", error);
        if (meta != null) {
            record.setGeneratedBy(meta.getPrincipalName());
            record.setGeneratedDate(meta.getCreated());
        }
        record.setUpstreamConsumer(createImportUpstreamConsumer(owner, null));
        record.setFileName(filename);

        record.recordStatus(ImportRecord.Status.FAILURE, error.getMessage());

        this.importRecordCurator.create(record);
    }
View Full Code Here

        this.importRecordCurator.create(record);
    }

    private void recordManifestDeletion(Owner owner, String username,
        UpstreamConsumer uc) {
        ImportRecord record = new ImportRecord(owner);
        record.setGeneratedBy(username);
        record.setGeneratedDate(new Date());
        String msg = i18n.tr("Subscriptions deleted by {0}", username);
        record.recordStatus(ImportRecord.Status.DELETE, msg);
        record.setUpstreamConsumer(createImportUpstreamConsumer(owner, uc));

        this.importRecordCurator.create(record);
    }
View Full Code Here

TOP

Related Classes of org.candlepin.model.ImportRecord

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.