use of org.csstudio.apputil.test.TestProperties 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.apputil.test.TestProperties in project org.csstudio.display.builder by kasemir.
the class ConnectJobTest method testConnectJob.
@Test(timeout = 20000)
public void testConnectJob() throws Exception {
final TestProperties settings = new TestProperties();
String url = settings.getString("archive_rdb_url");
if (url == null) {
System.out.println("Skipped");
return;
}
System.out.println("Connecting to " + url);
new ConnectJob(url) {
@Override
protected void archiveServerConnected(final String server_info, final ArchiveInfo[] infos) {
System.out.println("Connected to " + server_info);
System.out.println(infos.length + " archives:");
for (final ArchiveInfo info : infos) {
System.out.println(info.getKey() + ": " + info.getName() + " (" + info.getDescription() + ")");
}
info = "Connected";
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();
assertThat(info, equalTo("Connected"));
}
use of org.csstudio.apputil.test.TestProperties in project org.csstudio.display.builder by kasemir.
the class ArchiveFetchJobTest method testMultipleArchives.
/**
* Start ArchiveFetchJob for multiple data sources, one that fails, wait for its completion
*/
@Test(timeout = 60000)
public void testMultipleArchives() throws Exception {
final TestProperties settings = new TestProperties();
String url = settings.getString("archive_rdb_url");
if (url == null) {
System.out.println("Skipped");
return;
}
item = new PVItem("DTL_LLRF:IOC1:Load", 1.0);
// First URL is expected to fail
item.addArchiveDataSource(new ArchiveDataSource("Broken_URL", 1, "failed_test"));
// Second URL should return data
item.addArchiveDataSource(new ArchiveDataSource(url, 1, "test"));
runFetchJob();
}
use of org.csstudio.apputil.test.TestProperties in project org.csstudio.display.builder by kasemir.
the class ArchiveFetchJobTest method testArchiveFetchJob.
/**
* Start ArchiveFetchJob, wait for its completion
*/
@Test(timeout = 60000)
public void testArchiveFetchJob() throws Exception {
final TestProperties settings = new TestProperties();
String url = settings.getString("archive_rdb_url");
if (url == null) {
System.out.println("Skipped");
return;
}
item = new PVItem("DTL_LLRF:IOC1:Load", 1.0);
item.addArchiveDataSource(new ArchiveDataSource(url, 1, "test"));
runFetchJob();
}
Aggregations