}
public void testAcceptOK() throws DuplicateIDException {
//New project, single target, single tag lib
Project proj = new Project("Test project"); //$NON-NLS-1$
proj.setTagSettings(new DefaultTagSettings(libraries1_1));
proj.getTargets().addSequence(t1);
pm.setProject(proj);
proj.getSettings().addArmModule(new AbstractProbeModule(null,null) {
public void reset() {
//Noop
}
public void doConfirmUpdate(Probe p, TagAllocator pd,
DefiniteSequenceDB<? extends Probe> otherProbes) {
//Noop
}
public void doAnalysis(Probe p, TagAllocator pd,
DefiniteSequenceDB<? extends Probe> otherProbes) {
ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message(
"Dummy", //$NON-NLS-1$
new MessageType("DUMMY", "Dummy"),
Message.WARNING));
}
});
proj.getSettings().getDesignParameters().put(Analyzer.PROP_ACCEPT_OK_ARMS,"false");
proj.getSettings().getDesignParameters().put(Analyzer.PROP_ACCEPT_OK_CANDIDATES,"false");
//First design, expected to result in failure.
pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new GoodFairAcceptor(), new BestQualitySelector(), new DefaultProbeDesigner(new GreedyTagAllocator()), new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true)).run();
Probe p = proj.getProbes().getSequenceAt(0);
assertEquals("Tag allocation should have failed", 0, p.getTags().size()); //$NON-NLS-1$
assertEquals("Quality expected to be bad", ProbeMakerConstants.BAD_QUALITY, ProbeMakerPropertyUtils.getRank(p));
//New design, with accept OK pairs. Expected to generate candidates, but fail.
proj.getSettings().getDesignParameters().put(Analyzer.PROP_ACCEPT_OK_ARMS,"true");
proj.getSettings().getDesignParameters().put(Analyzer.PROP_ACCEPT_OK_CANDIDATES,"false");
ProbeDesignTask task = pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new GoodFairAcceptor(), new BestQualitySelector(), new DefaultProbeDesigner(new GreedyTagAllocator()), new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true));
task.run();
long candCount = task.getCandidatesGenerated();
p = proj.getProbes().getSequenceAt(0);
assertEquals("Tag allocation should have failed", 0, p.getTags().size()); //$NON-NLS-1$
assertEquals("Candidates expected", libraries1_1[0].size() , candCount);
assertEquals("Quality expected to be bad", ProbeMakerConstants.BAD_QUALITY, ProbeMakerPropertyUtils.getRank(p));
//New design, with accept OK pairs AND candidates. Expected to generate candidates, and find candidate with warning.
proj.getSettings().getDesignParameters().put(Analyzer.PROP_ACCEPT_OK_ARMS,"true");
proj.getSettings().getDesignParameters().put(Analyzer.PROP_ACCEPT_OK_CANDIDATES,"true");
task = pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new GoodFairAcceptor(), new BestQualitySelector(), new DefaultProbeDesigner(new GreedyTagAllocator()), new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true));
task.run();
candCount = task.getCandidatesGenerated();
p = proj.getProbes().getSequenceAt(0);
System.out.println("Probe");
for (Iterator<KeyValue> i = p.getPropertySet().getKeyValueIterator();i.hasNext();) {
System.out.println(i.next());
}
System.out.println("TSS Pair");