JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
}
- Sequence seq,upSeq;
+ Sequence seq,upSeq,upSeq_nocanonical;
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
+ "GTGVHPIVVVQPDAWTEDNGFHAIGQMCEAPVVTREWVLDSVALYQCQELDTYLIPQIPHSHY\n"
+ "", 1,
1863);
- upSeq.createDatasetSequence();
upSeq.setDescription("Breast cancer type 1 susceptibility protein");
+ upSeq_nocanonical = new Sequence(upSeq);
+ upSeq.createDatasetSequence();
upSeq.addDBRef(new DBRefEntry("UNIPROT","0","P38398",null,true));
+
+ upSeq_nocanonical.createDatasetSequence();
+ // not a canonical reference
+ upSeq_nocanonical.addDBRef(new DBRefEntry("UNIPROT","0","P38398",null,false));
+
}
@AfterMethod(alwaysRun = true)
{
seq = null;
upSeq=null;
+ upSeq_nocanonical=null;
}
@Test(groups = { "Functional" })
SequenceI[] selectedSeqs = new SequenceI[] { seq };
StructureChooser sc = new StructureChooser(selectedSeqs, seq, null);
+ ThreadwaitFor(200, sc);
// if structures are not discovered then don't
// populate filter options
}
+ @Test(groups = { "Functional" })
+ public void displayTDBQueryTest() throws InterruptedException
+ {
+ TDBeaconsFTSRestClientTest.setMock();
+ PDBFTSRestClientTest.setMock();
+
+ SequenceI[] selectedSeqs = new SequenceI[] { upSeq_nocanonical };
+ StructureChooser sc = new StructureChooser(selectedSeqs, upSeq_nocanonical, null);
+ // mock so should be quick. Exceptions from mocked PDBFTS are expected too
+ ThreadwaitFor(500, sc);
+
+ assertTrue(sc.isCanQueryTDB() && sc.isNotQueriedTDBYet());
+ }
+
@Test(groups = { "Network" })
public void fetchStructuresInfoTest()
{
PDBFTSRestClient.unMock((FTSRestClient) PDBFTSRestClient.getInstance());
SequenceI[] selectedSeqs = new SequenceI[] { seq };
StructureChooser sc = new StructureChooser(selectedSeqs, seq, null);
+ // not mocked, wait for 2s
+ ThreadwaitFor(2000, sc);
+
sc.fetchStructuresMetaData();
Collection<FTSData> ss = (Collection<FTSData>) PA.getValue(sc,
"discoveredStructuresSet");
PDBFTSRestClientTest.setMock();
SequenceI[] selectedSeqs = new SequenceI[] { upSeq };
StructureChooser sc = new StructureChooser(selectedSeqs, seq, null);
+ ThreadwaitFor(500, sc);
+
sc.fetchStructuresMetaData();
Collection<FTSData> ss = (Collection<FTSData>) PA.getValue(sc,
"discoveredStructuresSet");
assertTrue(ss.size() > 0);
}
+ private void ThreadwaitFor(int i, StructureChooser sc)
+ {
+ long timeout = i+System.currentTimeMillis();
+ while (!sc.isDialogVisible() && timeout > System.currentTimeMillis())
+ {
+ try {
+ Thread.sleep(50);
+ } catch (InterruptedException x)
+ {
+
+ }
+ }
+
+ }
+
+
@Test(groups = { "Functional" })
public void sanitizeSeqNameTest()
{