use of org.csstudio.trends.databrowser3.archive.SearchJob in project org.csstudio.display.builder by kasemir.
the class SearchJobTest method testSearchJob.
@Test(timeout = 20000)
public void testSearchJob() throws Exception {
final TestProperties settings = new TestProperties();
String url = settings.getString("archive_rdb_url");
if (url == null) {
System.out.println("Skipped");
return;
}
// final ArchiveReader reader =
// ArchiveRepository.getInstance().getArchiveReader(url);
final ArchiveDataSource[] archives = new ArchiveDataSource[] { new ArchiveDataSource(url, 1, "") };
new SearchJob(archives, "DTL_LLRF:FCM1:*", true) {
@Override
protected void receivedChannelInfos(final ChannelInfo[] channels) {
System.out.println("Found these channels:");
for (final ChannelInfo channel : channels) System.out.println(channel.getArchiveDataSource().getName() + " - " + channel.getProcessVariable().getName());
info = "Found " + channels.length + " channels";
done.countDown();
}
@Override
protected void archiveServerError(final String url, final Exception ex) {
info = NLS.bind(Messages.ArchiveServerErrorFmt, url, ex.getMessage());
done.countDown();
}
}.schedule();
// Wait for success or error
done.await();
System.out.println(info);
assertThat(info, notNullValue());
assertTrue(info.startsWith("Found"));
}
use of org.csstudio.trends.databrowser3.archive.SearchJob in project org.csstudio.display.builder by kasemir.
the class SearchView method searchForChannels.
/**
* Search selected archives for channels, updating the
* <code>channel_table</code> with the result
* @see #channel_table
*/
private void searchForChannels() {
final ArchiveDataSource[] archives = archive_gui.getSelectedArchives();
if (archives == null)
return;
final String pattern_txt = pattern.getText().trim();
// Warn when searching ALL channels
if (pattern_txt.length() <= 0) {
MessageDialog.openInformation(pattern.getShell(), Messages.Search, Messages.SearchPatternEmptyMessage);
// Aborted, move focus to search pattern
pattern.setFocus();
return;
}
new SearchJob(archives, pattern_txt, !regex.getSelection()) {
@Override
protected void receivedChannelInfos(final ChannelInfo[] channels) {
displayChannelInfos(channels);
}
@Override
protected void archiveServerError(final String url, final Exception ex) {
handleServerError(url, ex);
}
}.schedule();
}
Aggregations