use of org.nextprot.api.tasks.solr.indexer.entry.impl.ChromosomeFieldBuilder in project nextprot-api by calipho-sib.
the class ChromosomeFieldBuilderDiffTest method testGeneBand.
@SuppressWarnings("unchecked")
private void testGeneBand(Entry entry) {
Fields field = Fields.GENE_BAND;
ChromosomeFieldBuilder cfb = new ChromosomeFieldBuilder();
cfb.initializeBuilder(entry);
Set<String> actualSet = new TreeSet<String>();
List<String> geneBandValues = cfb.getFieldValue(field, List.class);
for (String s : geneBandValues) actualSet.addAll(Arrays.asList(s.split(" ")));
// in the current pam implementation the data is the same
// but can contains several times the same values and have a different order
// nevertheless the set of unique values should be the same
Set<String> expectedSet = new TreeSet<String>();
List<String> expectedValues = (List<String>) getValueForFieldInCurrentSolrImplementation(entry.getUniqueName(), field);
for (String s : expectedValues) expectedSet.addAll(Arrays.asList(s.split(" ")));
// showActualAndExpectedValues(expectedSet,actualSet, "gene_band");
assertEquals(expectedSet, actualSet);
}
use of org.nextprot.api.tasks.solr.indexer.entry.impl.ChromosomeFieldBuilder in project nextprot-api by calipho-sib.
the class ChromosomeFieldBuilderDiffTest method testChrLocS.
/*
*
* The old pam implementation now sorts alphabetically
* the multiple locations retrieved from db before indexing them in chr_loc field
* The new alain's implementation does the same as well now
* The value of chr_loc_s (sort order value for chr location) is computed
* on the basis of the first location found in chr_loc in both old and new implementation
*
*/
private void testChrLocS(Entry entry) {
ChromosomeFieldBuilder cfb = new ChromosomeFieldBuilder();
cfb.initializeBuilder(entry);
Integer expectedValue = (Integer) getValueForFieldInCurrentSolrImplementation(entry.getUniqueName(), Fields.CHR_LOC_S);
Integer actualValue = cfb.getFieldValue(Fields.CHR_LOC_S, Integer.class);
assertEquals(expectedValue, actualValue);
}
use of org.nextprot.api.tasks.solr.indexer.entry.impl.ChromosomeFieldBuilder in project nextprot-api by calipho-sib.
the class ChromosomeFieldBuilderDiffTest method testChrLoc.
private void testChrLoc(Entry entry) {
Fields field = Fields.CHR_LOC;
ChromosomeFieldBuilder cfb = new ChromosomeFieldBuilder();
cfb.initializeBuilder(entry);
// build a set with the list of actual values in field (which are separated by spaces)
Set<String> actualSet = new TreeSet<String>();
String actualValue = cfb.getFieldValue(field, String.class);
actualSet.addAll(Arrays.asList(actualValue.split(" ")));
// in the current pam implementation the data is the same
// but can contain several times the same values (and may have a different order)
// nevertheless the set of unique values should be the same
Set<String> expectedSet = new TreeSet<String>();
String expectedValue = (String) getValueForFieldInCurrentSolrImplementation(entry.getUniqueName(), field);
expectedSet.addAll(Arrays.asList(expectedValue.replace(",", "").split(" ")));
// showActualAndExpectedValues(expectedSet,actualSet, "chr_loc");
assertEquals(expectedSet, actualSet);
}
use of org.nextprot.api.tasks.solr.indexer.entry.impl.ChromosomeFieldBuilder in project nextprot-api by calipho-sib.
the class ChromosomeFieldBuilderIntegrationTest method testChrLoc.
@Test
public void testChrLoc() {
Fields field = Fields.CHR_LOC;
String entryName = "NX_Q06124";
Entry entry = entryBuilderService.build(EntryConfig.newConfig(entryName).withChromosomalLocations());
ChromosomeFieldBuilder cfb = new ChromosomeFieldBuilder();
cfb.initializeBuilder(entry);
String chrLocValue = cfb.getFieldValue(field, String.class);
assertTrue(chrLocValue.contains("12q24.13"));
}
Aggregations