Search in sources :

Example 1 with TestProperties

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"));
}
Also used : TestProperties(org.csstudio.apputil.test.TestProperties) ArchiveDataSource(org.csstudio.trends.databrowser3.model.ArchiveDataSource) ChannelInfo(org.csstudio.trends.databrowser3.model.ChannelInfo) Test(org.junit.Test)

Example 2 with TestProperties

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"));
}
Also used : TestProperties(org.csstudio.apputil.test.TestProperties) ArchiveInfo(org.csstudio.archive.reader.ArchiveInfo) Test(org.junit.Test)

Example 3 with TestProperties

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();
}
Also used : TestProperties(org.csstudio.apputil.test.TestProperties) ArchiveDataSource(org.csstudio.trends.databrowser3.model.ArchiveDataSource) PVItem(org.csstudio.trends.databrowser3.model.PVItem) Test(org.junit.Test)

Example 4 with TestProperties

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();
}
Also used : TestProperties(org.csstudio.apputil.test.TestProperties) ArchiveDataSource(org.csstudio.trends.databrowser3.model.ArchiveDataSource) PVItem(org.csstudio.trends.databrowser3.model.PVItem) Test(org.junit.Test)

Aggregations

TestProperties (org.csstudio.apputil.test.TestProperties)4 Test (org.junit.Test)4 ArchiveDataSource (org.csstudio.trends.databrowser3.model.ArchiveDataSource)3 PVItem (org.csstudio.trends.databrowser3.model.PVItem)2 ArchiveInfo (org.csstudio.archive.reader.ArchiveInfo)1 ChannelInfo (org.csstudio.trends.databrowser3.model.ChannelInfo)1