Skip to content

Commit 0e2187b

Browse files
authored
Merge pull request #1800 from ISISComputingGroup/Ticket_8731_Alerts_Dialog
Ticket 8731 alerts dialog
2 parents cba4616 + f372d1c commit 0e2187b

File tree

58 files changed

+4174
-21
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+4174
-21
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"><attributes><attribute name="module" value="true"/></attributes></classpathentry>
4+
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5+
<classpathentry kind="src" path="src"/>
6+
<classpathentry kind="output" path="target/classes"/>
7+
</classpath>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>uk.ac.stfc.isis.ibex.alerts.tests</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.pde.ManifestBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.pde.SchemaBuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>org.eclipse.m2e.core.maven2Builder</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
</buildSpec>
29+
<natures>
30+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
31+
<nature>org.eclipse.pde.PluginNature</nature>
32+
<nature>org.eclipse.jdt.core.javanature</nature>
33+
</natures>
34+
</projectDescription>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Manifest-Version: 1.0
2+
Bundle-ManifestVersion: 2
3+
Bundle-Name: Tests
4+
Bundle-SymbolicName: uk.ac.stfc.isis.ibex.alerts.tests
5+
Bundle-Version: 1.0.0.qualifier
6+
Fragment-Host: uk.ac.stfc.isis.ibex.alerts;bundle-version="1.0.0"
7+
Require-Bundle: org.junit;bundle-version="4.10.0",
8+
org.hamcrest,
9+
org.mockito.mockito-core;bundle-version="4.7.0",
10+
net.bytebuddy.byte-buddy;bundle-version="1.12.13",
11+
net.bytebuddy.byte-buddy-agent;bundle-version="1.12.13",
12+
org.objenesis;bundle-version="3.2.0"
13+
Bundle-RequiredExecutionEnvironment: JavaSE-21
14+
Automatic-Module-Name: uk.ac.stfc.isis.ibex.alerts.tests
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source.. = src/
2+
output.. = bin/
3+
bin.includes = META-INF/,\
4+
.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<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">
2+
<modelVersion>4.0.0</modelVersion>
3+
<artifactId>uk.ac.stfc.isis.ibex.alerts.tests</artifactId>
4+
<packaging>eclipse-test-plugin</packaging>
5+
<parent>
6+
<groupId>CSS_ISIS</groupId>
7+
<artifactId>uk.ac.stfc.isis.ibex.client.tycho.parent</artifactId>
8+
<version>1.0.0-SNAPSHOT</version>
9+
<relativePath>../uk.ac.stfc.isis.ibex.client.tycho.parent</relativePath>
10+
</parent>
11+
<build>
12+
<pluginManagement>
13+
<plugins>
14+
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
15+
<plugin>
16+
<groupId>org.eclipse.m2e</groupId>
17+
<artifactId>lifecycle-mapping</artifactId>
18+
<version>1.0.0</version>
19+
<configuration>
20+
<lifecycleMappingMetadata>
21+
<pluginExecutions>
22+
<pluginExecution>
23+
<pluginExecutionFilter>
24+
<groupId>org.jacoco</groupId>
25+
<artifactId>
26+
jacoco-maven-plugin
27+
</artifactId>
28+
<versionRange>
29+
[0.7.4.201502262128,)
30+
</versionRange>
31+
<goals>
32+
<goal>prepare-agent</goal>
33+
</goals>
34+
</pluginExecutionFilter>
35+
<action>
36+
<ignore></ignore>
37+
</action>
38+
</pluginExecution>
39+
</pluginExecutions>
40+
</lifecycleMappingMetadata>
41+
</configuration>
42+
</plugin>
43+
</plugins>
44+
</pluginManagement>
45+
</build>
46+
</project>
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* This file is part of the ISIS IBEX application. Copyright (C) 2012-2025
3+
* Science & Technology Facilities Council. All rights reserved.
4+
*
5+
* This program is distributed in the hope that it will be useful. This program
6+
* and the accompanying materials are made available under the terms of the
7+
* Eclipse Public License v1.0 which accompanies this distribution. EXCEPT AS
8+
* EXPRESSLY SET FORTH IN THE ECLIPSE PUBLIC LICENSE V1.0, THE PROGRAM AND
9+
* ACCOMPANYING MATERIALS ARE PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES
10+
* OR CONDITIONS OF ANY KIND. See the Eclipse Public License v1.0 for more
11+
* details.
12+
*
13+
* You should have received a copy of the Eclipse Public License v1.0 along with
14+
* this program; if not, you can obtain a copy from
15+
* https://www.eclipse.org/org/documents/epl-v10.php or
16+
* http://opensource.org/licenses/eclipse-1.0.php
17+
*/
18+
package uk.ac.stfc.isis.ibex.alerts.tests;
19+
20+
import static org.junit.Assert.*;
21+
import static org.mockito.Mockito.*;
22+
23+
import org.junit.Before;
24+
import org.junit.Test;
25+
import org.osgi.framework.BundleContext;
26+
27+
import uk.ac.stfc.isis.ibex.alerts.AlertsActivator;
28+
import uk.ac.stfc.isis.ibex.alerts.AlertsControlVariables;
29+
import uk.ac.stfc.isis.ibex.alerts.AlertsServer;
30+
31+
/**
32+
* Tests the AlertsActivator class.
33+
*/
34+
public class AlertsActivatorTest {
35+
36+
private AlertsActivator activator;
37+
private BundleContext mockContext;
38+
39+
@Before
40+
public void setUp() {
41+
mockContext = mock(BundleContext.class);
42+
activator = new AlertsActivator();
43+
}
44+
45+
@Test
46+
public void testSingletonInstance() {
47+
assertNotNull(AlertsActivator.getInstance());
48+
assertEquals(activator, AlertsActivator.getInstance());
49+
}
50+
51+
@Test
52+
public void testGetVariables() {
53+
AlertsControlVariables variables = activator.getVariables();
54+
assertNotNull(variables);
55+
}
56+
57+
@Test
58+
public void testGetServer() {
59+
AlertsServer server = activator.getServer();
60+
assertNotNull(server);
61+
}
62+
63+
@Test
64+
public void testStartSetsContext() throws Exception {
65+
activator.start(mockContext);
66+
assertEquals(mockContext, AlertsActivator.getContext());
67+
}
68+
69+
@Test
70+
public void testStopClearsContext() throws Exception {
71+
activator.start(mockContext);
72+
activator.stop(mockContext);
73+
assertNull(AlertsActivator.getContext());
74+
}
75+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/*
2+
* This file is part of the ISIS IBEX application. Copyright (C) 2012-2025
3+
* Science & Technology Facilities Council. All rights reserved.
4+
*
5+
* This program is distributed in the hope that it will be useful. This program
6+
* and the accompanying materials are made available under the terms of the
7+
* Eclipse Public License v1.0 which accompanies this distribution. EXCEPT AS
8+
* EXPRESSLY SET FORTH IN THE ECLIPSE PUBLIC LICENSE V1.0, THE PROGRAM AND
9+
* ACCOMPANYING MATERIALS ARE PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES
10+
* OR CONDITIONS OF ANY KIND. See the Eclipse Public License v1.0 for more
11+
* details.
12+
*
13+
* You should have received a copy of the Eclipse Public License v1.0 along with
14+
* this program; if not, you can obtain a copy from
15+
* https://www.eclipse.org/org/documents/epl-v10.php or
16+
* http://opensource.org/licenses/eclipse-1.0.php
17+
*/
18+
package uk.ac.stfc.isis.ibex.alerts.tests;
19+
20+
import static org.junit.Assert.*;
21+
22+
import org.junit.Before;
23+
import org.junit.Test;
24+
import uk.ac.stfc.isis.ibex.alerts.AlertsPVs;
25+
26+
/**
27+
* Tests the AlertsPVs class.
28+
*/
29+
public class AlertsPVsTest {
30+
31+
private AlertsPVs alertsPVs;
32+
33+
@Before
34+
public void setUp() {
35+
alertsPVs = new AlertsPVs();
36+
}
37+
38+
@Test
39+
public void testGetEmailsPv() {
40+
String expected = "CS:AC:ALERTS:EMAILS:SP";
41+
assertEquals(expected, alertsPVs.getEmailsPv());
42+
}
43+
44+
@Test
45+
public void testGetMobilesPv() {
46+
String expected = "CS:AC:ALERTS:MOBILES:SP";
47+
assertEquals(expected, alertsPVs.getMobilesPv());
48+
}
49+
50+
@Test
51+
public void testGetMessagePv() {
52+
String expected = "CS:AC:ALERTS:MESSAGE:SP";
53+
assertEquals(expected, alertsPVs.getMessagePv());
54+
}
55+
56+
@Test
57+
public void testGetLowLimitPv() {
58+
String blockName = "testBlock";
59+
String expected = "CS:SB:testBlock:AC:LOW";
60+
assertEquals(expected, alertsPVs.getLowLimitPv(blockName));
61+
}
62+
63+
@Test
64+
public void testGetHighLimitPv() {
65+
String blockName = "testBlock";
66+
String expected = "CS:SB:testBlock:AC:HIGH";
67+
assertEquals(expected, alertsPVs.getHighLimitPv(blockName));
68+
}
69+
70+
@Test
71+
public void testGetEnablePv() {
72+
String blockName = "testBlock";
73+
String expected = "CS:SB:testBlock:AC:ENABLE";
74+
assertEquals(expected, alertsPVs.getEnablePv(blockName));
75+
}
76+
77+
@Test
78+
public void testGetDelayInPv() {
79+
String blockName = "testBlock";
80+
String expected = "CS:SB:testBlock:AC:IN:DELAY";
81+
assertEquals(expected, alertsPVs.getDelayInPv(blockName));
82+
}
83+
84+
@Test
85+
public void testGetDelayOutPv() {
86+
String blockName = "testBlock";
87+
String expected = "CS:SB:testBlock:AC:OUT:DELAY";
88+
assertEquals(expected, alertsPVs.getDelayOutPv(blockName));
89+
}
90+
}

0 commit comments

Comments
 (0)