### Question:
RegisterToLongleafProcessor extends AbstractLongleafProcessor { public static boolean registerableBinary(Exchange exchange) { String fcrepoUri = (String) exchange.getIn().getHeader(FCREPO_URI); String dsId = StringUtils.substringAfterLast(fcrepoUri, "/"); if (dsId.equals("fcr:metadata")) { return false; } if (REGISTERABLE_IDS.contains(dsId)) { return true; } else { PID dsPid = PIDs.get(fcrepoUri); return dsPid.getQualifier().equals(RepositoryPathConstants.DEPOSIT_RECORD_BASE); } }  @SuppressWarnings("unchecked") @Override void process(Exchange exchange); void setRepositoryObjectLoader(RepositoryObjectLoader repoObjLoader); void setFcrepoClient(FcrepoClient fcrepoClient); static boolean registerableBinary(Exchange exchange); static final List<String> REGISTERABLE_IDS; }### Answer:
@Test public void registerableBinaryOriginal() throws Exception { PID binPid = DatastreamPids.getOriginalFilePid(filePid); Exchange exchange = createIndividualExchange(binPid); assertTrue(RegisterToLongleafProcessor.registerableBinary(exchange)); }
@Test public void registerableBinaryMdDescriptive() throws Exception { PID binPid = DatastreamPids.getMdDescriptivePid(filePid); Exchange exchange = createIndividualExchange(binPid); assertTrue(RegisterToLongleafProcessor.registerableBinary(exchange)); }
@Test public void registerableBinaryMdDescriptiveHistory() throws Exception { PID binPid = DatastreamPids.getMdDescriptivePid(filePid); binPid = DatastreamPids.getDatastreamHistoryPid(binPid); Exchange exchange = createIndividualExchange(binPid); assertTrue(RegisterToLongleafProcessor.registerableBinary(exchange)); }
@Test public void registerableBinaryMdEvents() throws Exception { PID binPid = DatastreamPids.getMdEventsPid(filePid); Exchange exchange = createIndividualExchange(binPid); assertTrue(RegisterToLongleafProcessor.registerableBinary(exchange)); }
@Test public void registerableBinaryTechMd() throws Exception { PID binPid = DatastreamPids.getTechnicalMetadataPid(filePid); Exchange exchange = createIndividualExchange(binPid); assertTrue(RegisterToLongleafProcessor.registerableBinary(exchange)); }
@Test public void registerableBinaryManifest() throws Exception { PID depositPid = pidMinter.mintDepositRecordPid(); PID binPid = DatastreamPids.getDepositManifestPid(depositPid, "mets.xml"); Exchange exchange = createIndividualExchange(binPid); assertTrue(RegisterToLongleafProcessor.registerableBinary(exchange)); }
@Test public void registerableBinaryJp2() throws Exception { PID binPid = PIDs.get(filePid.getRepositoryPath() + "/data/jp2"); Exchange exchange = createIndividualExchange(binPid); assertFalse(RegisterToLongleafProcessor.registerableBinary(exchange)); }
@Test public void registerableBinaryManifestMetadata() throws Exception { PID depositPid = pidMinter.mintDepositRecordPid(); PID binPid = DatastreamPids.getDepositManifestPid(depositPid, "mets.xml"); PID mdPid = PIDs.get(binPid.getRepositoryPath() + "/fcr:metadata"); Exchange exchange = createIndividualExchange(mdPid); assertFalse(RegisterToLongleafProcessor.registerableBinary(exchange)); }