Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions base/uk.ac.stfc.isis.ibex.alerts.tests/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"><attributes><attribute name="module" value="true"/></attributes></classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
34 changes: 34 additions & 0 deletions base/uk.ac.stfc.isis.ibex.alerts.tests/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>uk.ac.stfc.isis.ibex.alerts.tests</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
14 changes: 14 additions & 0 deletions base/uk.ac.stfc.isis.ibex.alerts.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tests
Bundle-SymbolicName: uk.ac.stfc.isis.ibex.alerts.tests
Bundle-Version: 1.0.0.qualifier
Fragment-Host: uk.ac.stfc.isis.ibex.alerts;bundle-version="1.0.0"
Require-Bundle: org.junit;bundle-version="4.10.0",
org.hamcrest,
org.mockito.mockito-core;bundle-version="4.7.0",
net.bytebuddy.byte-buddy;bundle-version="1.12.13",
net.bytebuddy.byte-buddy-agent;bundle-version="1.12.13",
org.objenesis;bundle-version="3.2.0"
Bundle-RequiredExecutionEnvironment: JavaSE-21
Automatic-Module-Name: uk.ac.stfc.isis.ibex.alerts.tests
4 changes: 4 additions & 0 deletions base/uk.ac.stfc.isis.ibex.alerts.tests/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
46 changes: 46 additions & 0 deletions base/uk.ac.stfc.isis.ibex.alerts.tests/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>uk.ac.stfc.isis.ibex.alerts.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>
<parent>
<groupId>CSS_ISIS</groupId>
<artifactId>uk.ac.stfc.isis.ibex.client.tycho.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../uk.ac.stfc.isis.ibex.client.tycho.parent</relativePath>
</parent>
<build>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.jacoco</groupId>
<artifactId>
jacoco-maven-plugin
</artifactId>
<versionRange>
[0.7.4.201502262128,)
</versionRange>
<goals>
<goal>prepare-agent</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* This file is part of the ISIS IBEX application. Copyright (C) 2012-2025
* Science & Technology Facilities Council. All rights reserved.
*
* This program is distributed in the hope that it will be useful. This program
* and the accompanying materials are made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution. EXCEPT AS
* EXPRESSLY SET FORTH IN THE ECLIPSE PUBLIC LICENSE V1.0, THE PROGRAM AND
* ACCOMPANYING MATERIALS ARE PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND. See the Eclipse Public License v1.0 for more
* details.
*
* You should have received a copy of the Eclipse Public License v1.0 along with
* this program; if not, you can obtain a copy from
* https://www.eclipse.org/org/documents/epl-v10.php or
* http://opensource.org/licenses/eclipse-1.0.php
*/
package uk.ac.stfc.isis.ibex.alerts.tests;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.BundleContext;

import uk.ac.stfc.isis.ibex.alerts.AlertsActivator;
import uk.ac.stfc.isis.ibex.alerts.AlertsControlVariables;
import uk.ac.stfc.isis.ibex.alerts.AlertsServer;

/**
* Tests the AlertsActivator class.
*/
public class AlertsActivatorTest {

private AlertsActivator activator;
private BundleContext mockContext;

@Before
public void setUp() {
mockContext = mock(BundleContext.class);
activator = new AlertsActivator();
}

@Test
public void testSingletonInstance() {
assertNotNull(AlertsActivator.getInstance());
assertEquals(activator, AlertsActivator.getInstance());
}

@Test
public void testGetVariables() {
AlertsControlVariables variables = activator.getVariables();
assertNotNull(variables);
}

@Test
public void testGetServer() {
AlertsServer server = activator.getServer();
assertNotNull(server);
}

@Test
public void testStartSetsContext() throws Exception {
activator.start(mockContext);
assertEquals(mockContext, AlertsActivator.getContext());
}

@Test
public void testStopClearsContext() throws Exception {
activator.start(mockContext);
activator.stop(mockContext);
assertNull(AlertsActivator.getContext());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* This file is part of the ISIS IBEX application. Copyright (C) 2012-2025
* Science & Technology Facilities Council. All rights reserved.
*
* This program is distributed in the hope that it will be useful. This program
* and the accompanying materials are made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution. EXCEPT AS
* EXPRESSLY SET FORTH IN THE ECLIPSE PUBLIC LICENSE V1.0, THE PROGRAM AND
* ACCOMPANYING MATERIALS ARE PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND. See the Eclipse Public License v1.0 for more
* details.
*
* You should have received a copy of the Eclipse Public License v1.0 along with
* this program; if not, you can obtain a copy from
* https://www.eclipse.org/org/documents/epl-v10.php or
* http://opensource.org/licenses/eclipse-1.0.php
*/
package uk.ac.stfc.isis.ibex.alerts.tests;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;
import uk.ac.stfc.isis.ibex.alerts.AlertsPVs;

/**
* Tests the AlertsPVs class.
*/
public class AlertsPVsTest {

private AlertsPVs alertsPVs;

@Before
public void setUp() {
alertsPVs = new AlertsPVs();
}

@Test
public void testGetEmailsPv() {
String expected = "CS:AC:ALERTS:EMAILS:SP";
assertEquals(expected, alertsPVs.getEmailsPv());
}

@Test
public void testGetMobilesPv() {
String expected = "CS:AC:ALERTS:MOBILES:SP";
assertEquals(expected, alertsPVs.getMobilesPv());
}

@Test
public void testGetMessagePv() {
String expected = "CS:AC:ALERTS:MESSAGE:SP";
assertEquals(expected, alertsPVs.getMessagePv());
}

@Test
public void testGetLowLimitPv() {
String blockName = "testBlock";
String expected = "CS:SB:testBlock:AC:LOW";
assertEquals(expected, alertsPVs.getLowLimitPv(blockName));
}

@Test
public void testGetHighLimitPv() {
String blockName = "testBlock";
String expected = "CS:SB:testBlock:AC:HIGH";
assertEquals(expected, alertsPVs.getHighLimitPv(blockName));
}

@Test
public void testGetEnablePv() {
String blockName = "testBlock";
String expected = "CS:SB:testBlock:AC:ENABLE";
assertEquals(expected, alertsPVs.getEnablePv(blockName));
}

@Test
public void testGetDelayInPv() {
String blockName = "testBlock";
String expected = "CS:SB:testBlock:AC:IN:DELAY";
assertEquals(expected, alertsPVs.getDelayInPv(blockName));
}

@Test
public void testGetDelayOutPv() {
String blockName = "testBlock";
String expected = "CS:SB:testBlock:AC:OUT:DELAY";
assertEquals(expected, alertsPVs.getDelayOutPv(blockName));
}
}
Loading
Loading