org.apache.camel.impl.DefaultExchange Java Examples

The following examples show how to use org.apache.camel.impl.DefaultExchange. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FileEntryLatchTest.java    From secure-data-service with Apache License 2.0 6 votes vote down vote up
@Test
public void testReceive() throws Exception {
    Exchange exchange =  new DefaultExchange(new DefaultCamelContext());
    IngestionFileEntry entry = new IngestionFileEntry("/", FileFormat.EDFI_XML, FileType.XML_STUDENT_PROGRAM, "fileName", "111");
    FileEntryWorkNote workNote = new FileEntryWorkNote("batchJobId", entry, false);
    boolean fileEntryLatchOpened;

    exchange.getIn().setBody(workNote, FileEntryWorkNote.class);

    fileEntryLatchOpened = fileEntryLatch.lastFileProcessed(exchange);

    Assert.assertFalse(fileEntryLatchOpened);

    fileEntryLatchOpened = fileEntryLatch.lastFileProcessed(exchange);

    Assert.assertTrue(fileEntryLatchOpened);
}
 
Example #2
Source File: DeltaProcessorTest.java    From secure-data-service with Apache License 2.0 6 votes vote down vote up
@Test
public void unSupportedEntitiesTest() throws Exception {
    Exchange exchange = new DefaultExchange(new DefaultCamelContext());

    List<NeutralRecord> neutralRecords = new ArrayList<NeutralRecord>();
    neutralRecords.add(createNeutralRecord("gradingPeriod"));

    NeutralRecordWorkNote workNote = new NeutralRecordWorkNote(neutralRecords, "batchJobId", false);

    exchange.getIn().setBody(workNote);

    deltaProcessor.process(exchange);

    NeutralRecordWorkNote newWorkNote = exchange.getIn().getBody(NeutralRecordWorkNote.class);
    List<NeutralRecord> filteredRecords = newWorkNote.getNeutralRecords();

    Assert.assertNotNull(filteredRecords);
    Assert.assertEquals(1, filteredRecords.size());
    Assert.assertEquals("gradingPeriod", filteredRecords.get(0).getRecordType());
}
 
Example #3
Source File: ZipFileProcessorTest.java    From secure-data-service with Apache License 2.0 6 votes vote down vote up
@Test
public void testNoControlFileZipFileProcessor() throws Exception {

    Exchange preObject = new DefaultExchange(new DefaultCamelContext());

    String batchJobId = NewBatchJob.createId("NoControlFile.zip");
    Mockito.when(workNote.getBatchJobId()).thenReturn(batchJobId);
    preObject.getIn().setBody(workNote);
    Mockito.when(mockedBatchJobDAO.findBatchJobById(Matchers.eq(batchJobId))).thenReturn(mockedJob);

    File zipFile = IngestionTest.getFile("zip/NoControlFile.zip");
    ResourceEntry entry = new ResourceEntry();
    entry.setResourceName(zipFile.getAbsolutePath());
    Mockito.when(mockedJob.getZipResourceEntry()).thenReturn(entry);

    createResourceEntryAndAddToJob(zipFile, mockedJob);
    mockedJob.setSourceId("zip");
    Mockito.when(mockedBatchJobDAO.findBatchJobById(Matchers.eq(batchJobId))).thenReturn(mockedJob);
    preObject.getIn().setHeader("BatchJobId", batchJobId);

    zipProc.process(preObject);

    Assert.assertNotNull(preObject.getIn().getBody());
    Assert.assertTrue(preObject.getIn().getBody(WorkNote.class).hasErrors());
    Assert.assertEquals(preObject.getIn().getHeader("IngestionMessageType") , MessageType.BATCH_REQUEST.name());
}
 
Example #4
Source File: LandingZoneProcessorTest.java    From secure-data-service with Apache License 2.0 6 votes vote down vote up
/**
 * Test to check that ingestion file in lz submitted to LandingZoneProcessor is not a zip file.
 *
 * @throws Exception
 */
@Test
public void testNonZipFileInLz() throws Exception {

    File unzippedLzPathFile = new File("/test/lz/inbound/TEST-LZ/testFile.ctl");
    String validLzPathname = unzippedLzPathFile.getParent();
    List<String> testLzPaths = new ArrayList<String>();
    testLzPaths.add(validLzPathname);
    when(mockedTenantDA.getLzPaths()).thenReturn(testLzPaths);

    // Submit a valid landing zone with a non-zip file.
    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    exchange.getIn().setHeader("filePath", unzippedLzPathFile.getPath());
    landingZoneProcessor.process(exchange);

    // Check there is no error in the exchange.
    assertTrue("Header on exchange should indicate failure", exchange.getIn().getBody(WorkNote.class).hasErrors());
}
 
Example #5
Source File: TenantProcessorTest.java    From secure-data-service with Apache License 2.0 6 votes vote down vote up
/**
 * Test to check that a single lz that is added to the
 * tenant collection is added by processor.
 *
 * @throws Exception
 */
@Test
public void shouldAddNewLz() throws Exception {

    List<String> testLzPaths = new ArrayList<String>();
    testLzPaths.add("."); // this must be a path that exists on all platforms
    when(mockedTenantDA.getLzPaths()).thenReturn(testLzPaths);

    // get a test tenantRecord
    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    tenantProcessor.process(exchange);

    // check there is no error on the received message
    assertEquals("Header on exchange should indicate success", TenantProcessor.TENANT_POLL_SUCCESS, exchange
            .getIn().getHeader(TenantProcessor.TENANT_POLL_HEADER));
}
 
Example #6
Source File: LandingZoneProcessorTest.java    From secure-data-service with Apache License 2.0 6 votes vote down vote up
/**
 * Test to check that an lz submitted to LandingZoneProcessor is invalid.
 *
 * @throws Exception
 */
@Test
public void testInvalidLz() throws Exception {

    File validLzPathFile = new File("/test/lz/inbound/TEST-LZ/testFile.zip");
    String validLzPathname = validLzPathFile.getParent();
    List<String> testLzPaths = new ArrayList<String>();
    testLzPaths.add(validLzPathname);
    when(mockedTenantDA.getLzPaths()).thenReturn(testLzPaths);

    // Submit an invalid landing zone.
    File inValidLzPathFile = new File("/test/lz/inbound/BAD-TEST-LZ/testFile.zip");
    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    exchange.getIn().setHeader("filePath", inValidLzPathFile.getPath());

    landingZoneProcessor.process(exchange);

    // Check there is an error in the exchange.
    assertTrue("Header on exchange should indicate failure", exchange.getIn().getBody(WorkNote.class).hasErrors());
}
 
Example #7
Source File: LandingZoneProcessorTest.java    From secure-data-service with Apache License 2.0 6 votes vote down vote up
/**
 * Test to check that an lz submitted to LandingZoneProcessor is valid.
 *
 * @throws Exception
 */
@Test
public void testValidLz() throws Exception {

    File validLzPathFile = new File("/test/lz/inbound/TEST-LZ/testFile.zip");
    String validLzPathname = validLzPathFile.getParent();
    List<String> testLzPaths = new ArrayList<String>();
    testLzPaths.add(validLzPathname);
    when(mockedTenantDA.getLzPaths()).thenReturn(testLzPaths);

    // Submit a valid landing zone with a zip file.
    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    exchange.getIn().setHeader("filePath", validLzPathFile.getPath());
    landingZoneProcessor.process(exchange);

    // Check there is no error in the exchange.
    assertFalse("Header on exchange should indicate success", exchange.getIn().getBody(WorkNote.class).hasErrors());
}
 
Example #8
Source File: EdFiParserProcessorTest.java    From secure-data-service with Apache License 2.0 5 votes vote down vote up
private Exchange createFileEntryExchange() throws IOException {
    IngestionFileEntry ife = Mockito.mock(IngestionFileEntry.class);
    InputStream is = Mockito.mock(InputStream.class);
    Mockito.when(ife.getFileStream()).thenReturn(is);
    FileType type = FileType.XML_STUDENT_PARENT_ASSOCIATION;
    Mockito.when(ife.getFileType()).thenReturn(type);
    FileEntryWorkNote workNote = new FileEntryWorkNote("batchJobId", ife, false);

    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    exchange.getIn().setBody(workNote);

    return exchange;
}
 
Example #9
Source File: DeltaProcessorTest.java    From secure-data-service with Apache License 2.0 5 votes vote down vote up
@Test
public void testNotPrevIngested() throws Exception{

    NeutralRecord nr = createNeutralRecord("student");
    List<NeutralRecord> neutralRecords = new ArrayList<NeutralRecord>();
    neutralRecords.add(nr);

    DidSchemaParser didSchemaParser = Mockito.mock(DidSchemaParser.class);
    Mockito.when(dIdResolver.getDidSchemaParser()).thenReturn(didSchemaParser);
    Map<String, List<DidNaturalKey>> naturalKeysMap = new HashMap<String, List<DidNaturalKey>>();
    naturalKeysMap.put(nr.getRecordType(), new ArrayList<DidNaturalKey>());
    Mockito.when(didSchemaParser.getNaturalKeys()).thenReturn(naturalKeysMap);
    Mockito.when(dIdStrategy.generateId(Mockito.any(NaturalKeyDescriptor.class))).thenReturn("recordId");

    Mockito.when(batchJobDAO.findRecordHash("tenantId", "recordId")).thenReturn(null);

    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    NeutralRecordWorkNote workNote = new NeutralRecordWorkNote(neutralRecords, "batchJobId", false);
    exchange.getIn().setBody(workNote);

    deltaProcessor.process(exchange);

    NeutralRecordWorkNote newWorkNote = exchange.getIn().getBody(NeutralRecordWorkNote.class);
    List<NeutralRecord> filteredRecords = newWorkNote.getNeutralRecords();

    Assert.assertNotNull(filteredRecords);
    Assert.assertEquals(1, filteredRecords.size());
    Assert.assertEquals("student", filteredRecords.get(0).getRecordType());

}
 
Example #10
Source File: DeltaProcessorTest.java    From secure-data-service with Apache License 2.0 5 votes vote down vote up
@Test
public void testPrevIngested() throws Exception{

    DidSchemaParser didSchemaParser = Mockito.mock(DidSchemaParser.class);
    Mockito.when(dIdResolver.getDidSchemaParser()).thenReturn(didSchemaParser);

    Map<String, List<DidNaturalKey>> naturalKeys = new HashMap<String, List<DidNaturalKey>>();
    naturalKeys.put("student", new ArrayList<DidNaturalKey>());

    Mockito.when(didSchemaParser.getNaturalKeys()).thenReturn(naturalKeys);
    Mockito.when(dIdStrategy.generateId(Mockito.any(NaturalKeyDescriptor.class))).thenReturn("recordId");

    NeutralRecord nr = createNeutralRecord("student");
    List<NeutralRecord> neutralRecords = new ArrayList<NeutralRecord>();
    neutralRecords.add(nr);

    RecordHash recordHash = Mockito.mock(RecordHash.class);
    String recordHashValues = nr.generateRecordHash("tenantId");

    Mockito.when(recordHash.getHash()).thenReturn(recordHashValues);
    Mockito.when(batchJobDAO.findRecordHash("tenantId", "recordId")).thenReturn(recordHash);

    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    NeutralRecordWorkNote workNote = new NeutralRecordWorkNote(neutralRecords, "batchJobId", false);
    exchange.getIn().setBody(workNote);

    deltaProcessor.process(exchange);

    NeutralRecordWorkNote newWorkNote = exchange.getIn().getBody(NeutralRecordWorkNote.class);
    List<NeutralRecord> filteredRecords = newWorkNote.getNeutralRecords();

    Assert.assertNotNull(filteredRecords);
    Assert.assertEquals(0, filteredRecords.size());

}
 
Example #11
Source File: DeltaProcessorTest.java    From secure-data-service with Apache License 2.0 5 votes vote down vote up
@Test
public void testDisableDeltaMode() throws Exception {
    Map<String, String> batchProperties = new HashMap<String, String>();
    batchProperties.put(AttributeType.DUPLICATE_DETECTION.getName(), RecordHash.RECORD_HASH_MODE_DISABLE);
    Mockito.when(job.getBatchProperties()).thenReturn(batchProperties);

    Exchange exchange = new DefaultExchange(new DefaultCamelContext());

    List<NeutralRecord> neutralRecords = new ArrayList<NeutralRecord>();
    neutralRecords.add(createNeutralRecord("gradingPeriod"));
    neutralRecords.add(createNeutralRecord("student"));
    neutralRecords.add(createNeutralRecord("grade"));

    NeutralRecordWorkNote workNote = new NeutralRecordWorkNote(neutralRecords, "batchJobId", false);

    exchange.getIn().setBody(workNote);

    deltaProcessor.process(exchange);

    NeutralRecordWorkNote newWorkNote = exchange.getIn().getBody(NeutralRecordWorkNote.class);
    List<NeutralRecord> filteredRecords = newWorkNote.getNeutralRecords();

    Assert.assertNotNull(filteredRecords);
    Assert.assertEquals(3, filteredRecords.size());
    Assert.assertEquals("gradingPeriod", filteredRecords.get(0).getRecordType());
    Assert.assertEquals("student", filteredRecords.get(1).getRecordType());
    Assert.assertEquals("grade", filteredRecords.get(2).getRecordType());
}
 
Example #12
Source File: BatchJobManagerTest.java    From secure-data-service with Apache License 2.0 5 votes vote down vote up
@Test
public void testNoPurgeDeltas() throws Exception {
    Mockito.when(batchJobDAO.getDuplicateDetectionMode(jobId)).thenReturn(null);

    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    WorkNote workNote = new WorkNote(jobId, false);
    exchange.getIn().setBody(workNote);

    boolean isEligible = batchJobManager.isEligibleForDeltaPurge(exchange);

    Assert.assertFalse(isEligible);
}
 
Example #13
Source File: BatchJobManagerTest.java    From secure-data-service with Apache License 2.0 5 votes vote down vote up
@Test
public void testPurgeResetDeltas() throws Exception {
    Mockito.when(batchJobDAO.getDuplicateDetectionMode(jobId)).thenReturn(RecordHash.RECORD_HASH_MODE_RESET);

    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    WorkNote workNote = new WorkNote(jobId, false);
    exchange.getIn().setBody(workNote);

    boolean isEligible = batchJobManager.isEligibleForDeltaPurge(exchange);

    Assert.assertTrue(isEligible);
}
 
Example #14
Source File: RenditionEventProcessorTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
private Exchange createExchange()
{
    return new DefaultExchange(camelContext);
}
 
Example #15
Source File: ZipFileProcessorTest.java    From secure-data-service with Apache License 2.0 4 votes vote down vote up
@Test
public void testHappyZipFileProcessor() throws Exception {

    Exchange preObject = new DefaultExchange(new DefaultCamelContext());

    String batchJobId = NewBatchJob.createId("ValidZip.zip");
    Mockito.when(workNote.getBatchJobId()).thenReturn(batchJobId);

    preObject.getIn().setBody(workNote);
    Mockito.when(mockedBatchJobDAO.findBatchJobById(Matchers.eq(batchJobId))).thenReturn(mockedJob);

    File zipFile = IngestionTest.getFile("zip/ValidZip.zip");
    ResourceEntry entry = new ResourceEntry();
    entry.setResourceName(zipFile.getAbsolutePath());
    Mockito.when(mockedJob.getZipResourceEntry()).thenReturn(entry);

    createResourceEntryAndAddToJob(zipFile, mockedJob);
    mockedJob.setSourceId("zip");

    preObject.getIn().setHeader("BatchJobId", batchJobId);

    zipProc.process(preObject);

    Assert.assertNotNull(preObject.getIn().getBody());
}
 
Example #16
Source File: ControlFileProcessorTest.java    From secure-data-service with Apache License 2.0 4 votes vote down vote up
@Test
    public void shouldAcceptExchangeObjectReadExchangeControlFileAndSetExchangeBatchJob() throws Exception {

        Exchange preObject = new DefaultExchange(new DefaultCamelContext());

        WorkNote workNote = Mockito.mock(WorkNote.class);
        String batchJobId = NewBatchJob.createId("InterchangeStudentCsv.ctl");
        NewBatchJob mockedJob = Mockito.mock(NewBatchJob.class);
        Mockito.when(mockedJob.getBatchProperties()).thenReturn(new HashMap <String, String>());

        Mockito.when(workNote.getBatchJobId()).thenReturn(batchJobId);
        Mockito.when(mockedBatchJobDAO.findBatchJobById(Matchers.eq(batchJobId))).thenReturn(mockedJob);


        preObject.getIn().setBody(workNote);

        processor.process(preObject);

//        NewBatchJob bj = preObject.getIn().getBody(NewBatchJob.class);
//
//        assertNotNull("BatchJob is not defined", bj);

        boolean hasErrors = (Boolean) preObject.getIn().getHeader("hasErrors");

        assertNotNull("header [hasErrors] not set", hasErrors);
    }
 
Example #17
Source File: ManagementBusServiceImpl.java    From container with Apache License 2.0 4 votes vote down vote up
/**
 * Delete all endpoints for the given ServiceTemplateInstance from the <tt>EndpointService</tt>. In case an endpoint
 * is the only one for a certain implementation artifact, it is undeployed too.
 *
 * @param csarID          The CSAR to which the ServiceTemplateInstance belongs.
 * @param serviceInstance The ServiceTemplateInstance for which the endpoints have to be removed.
 */
private void deleteEndpointsForServiceInstance(final CsarId csarID, final ServiceTemplateInstance serviceInstance) {
    final Long instanceID = serviceInstance.getId();
    LOG.debug("Deleting endpoints for ServiceTemplateInstance with ID: {}", instanceID);

    final Csar csar = storage.findById(csarID);

    final List<WSDLEndpoint> serviceEndpoints =
        endpointService.getWSDLEndpointsForSTID(Settings.OPENTOSCA_CONTAINER_HOSTNAME, instanceID);
    LOG.debug("Found {} endpoints to delete...", serviceEndpoints.size());

    for (final WSDLEndpoint serviceEndpoint : serviceEndpoints) {

        final String triggeringContainer = serviceEndpoint.getTriggeringContainer();
        final String deploymentLocation = serviceEndpoint.getManagingContainer();
        final QName typeImpl = serviceEndpoint.getTypeImplementation();
        final String iaName = serviceEndpoint.getIaName();

        LOG.debug("Deleting endpoint: Triggering Container: {}; "
                + "Managing Container: {}; NodeTypeImplementation: {}; IA name: {}", triggeringContainer,
            deploymentLocation, typeImpl, iaName);

        final String identifier =
            getUniqueSynchronizationString(triggeringContainer, deploymentLocation, typeImpl, iaName, instanceID.toString());

        // synchronize deletion to avoid concurrency issues
        synchronized (getLockForString(identifier)) {

            // get number of endpoints for the same IA
            final int count = endpointService
                .getWSDLEndpointsForNTImplAndIAName(triggeringContainer,
                    deploymentLocation,
                    typeImpl, iaName)
                .size();

            // only undeploy the IA if this is the only endpoint
            if (count == 1) {
                LOG.debug("Undeploying corresponding IA...");
                final TImplementationArtifact ia;
                try {
                    TEntityTypeImplementation typeImplementation = ToscaEngine.resolveTypeImplementation(csar, typeImpl);
                    ia = ToscaEngine.resolveImplementationArtifact(typeImplementation, iaName);
                } catch (NotFoundException e) {
                    LOG.warn("Could not find ImplementationArtifact {} for existing WSDLEndpoint  [{}] in Csar [{}]", iaName, serviceEndpoint, csar.id());
                    continue;
                }
                final String artifactType = ia.getArtifactType().toString();

                // create exchange for the undeployment plug-in invocation
                Exchange exchange = new DefaultExchange(collaborationContext.getCamelContext());
                exchange.getIn().setHeader(MBHeader.ENDPOINT_URI.toString(), serviceEndpoint.getURI());

                // get plug-in for the undeployment
                IManagementBusDeploymentPluginService deploymentPlugin;
                if (deploymentLocation.equals(Settings.OPENTOSCA_CONTAINER_HOSTNAME)) {
                    LOG.debug("Undeployment is done locally.");
                    deploymentPlugin = pluginRegistry.getDeploymentPluginServices().get(artifactType);
                } else {
                    LOG.debug("Undeployment is done on a remote Container.");
                    deploymentPlugin = pluginRegistry.getDeploymentPluginServices().get(Constants.REMOTE_TYPE);

                    // add header fields that are needed for the undeployment on a
                    // remote OpenTOSCA Container
                    exchange.getIn().setHeader(MBHeader.DEPLOYMENTLOCATION_STRING.toString(), deploymentLocation);
                    exchange.getIn().setHeader(MBHeader.TRIGGERINGCONTAINER_STRING.toString(), triggeringContainer);
                    exchange.getIn().setHeader(MBHeader.TYPEIMPLEMENTATIONID_QNAME.toString(), typeImpl.toString());
                    exchange.getIn().setHeader(MBHeader.IMPLEMENTATION_ARTIFACT_NAME_STRING.toString(), iaName);
                    exchange.getIn().setHeader(MBHeader.ARTIFACTTYPEID_STRING.toString(), artifactType);
                }

                exchange = deploymentPlugin.invokeImplementationArtifactUndeployment(exchange);

                // print the undeployment result state
                if (exchange.getIn().getHeader(MBHeader.OPERATIONSTATE_BOOLEAN.toString(), boolean.class)) {
                    LOG.debug("Undeployed IA successfully!");
                } else {
                    LOG.warn("Undeployment of IA failed!");
                }
            } else {
                LOG.debug("Found further endpoints for the IA. No undeployment!");
            }

            // delete the endpoint
            endpointService.removeWSDLEndpoint(serviceEndpoint);
            LOG.debug("Endpoint deleted.");
        }
    }

    LOG.debug("Endpoint deletion terminated.");
}
 
Example #18
Source File: DeltaHashPurgeProcessorTest.java    From secure-data-service with Apache License 2.0 3 votes vote down vote up
@Test
public void testPurgeDeltas() throws Exception {
    Mockito.when(job.getProperty(AttributeType.DUPLICATE_DETECTION.getName())).thenReturn(RecordHash.RECORD_HASH_MODE_DISABLE);

    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    WorkNote workNote = new WorkNote("batchJobId", false);

    exchange.getIn().setBody(workNote);

    deltaHashPurgeProcessor.process(exchange);

    Mockito.verify(batchJobDAO, Mockito.atLeastOnce()).removeRecordHashByTenant("tenantId");
}
 
Example #19
Source File: ControlFilePreProcessorTest.java    From secure-data-service with Apache License 2.0 3 votes vote down vote up
@Test
public void testProcess() throws Exception {
    List<Stage> mockedStages = createFakeStages();
    Map<String, String> mockedProperties = createFakeBatchProperties();

    File testZip = IngestionTest.getFile("ctl_tmp/test.zip");

    NewBatchJob job = new NewBatchJob(BATCHJOBID, testZip.getAbsolutePath(), "finished", 29, mockedProperties, mockedStages, null);

    job.setBatchProperties(mockedProperties);
    job.setTenantId(tenantId);

    ResourceEntry entry = new ResourceEntry();
    entry.setResourceName(testZip.getAbsolutePath());
    entry.setResourceFormat(FileFormat.ZIP_FILE.getCode());
    job.addResourceEntry(entry);

    WorkNote workNote = Mockito.mock(WorkNote.class);
    Mockito.when(workNote.getBatchJobId()).thenReturn(BATCHJOBID);

    Exchange exchange = new DefaultExchange(new DefaultCamelContext());

    exchange.getIn().setBody(workNote);

    Mockito.when(mockedBatchJobDAO.findBatchJobById(Matchers.eq(BATCHJOBID))).thenReturn(job);

    controlFilePreProcessor.setBatchJobDAO(mockedBatchJobDAO);
    controlFilePreProcessor.setTenantDA(mockedTenantDA);

    controlFilePreProcessor.process(exchange);

    Assert.assertEquals(2, job.getResourceEntries().size());
    Assert.assertEquals(29, job.getTotalFiles());
}
 
Example #20
Source File: BatchJobManagerTest.java    From secure-data-service with Apache License 2.0 3 votes vote down vote up
@Test
public void testPurgeDisableDeltas() throws Exception {

    Mockito.when(batchJobDAO.getDuplicateDetectionMode(jobId)).thenReturn(RecordHash.RECORD_HASH_MODE_DISABLE);

    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    WorkNote workNote = new WorkNote(jobId, false);
    exchange.getIn().setBody(workNote);

    boolean isEligible = batchJobManager.isEligibleForDeltaPurge(exchange);

    Assert.assertTrue(isEligible);

}