Class PublisherTest
- java.lang.Object
-
- org.opentrafficsim.sim0mq.publisher.PublisherTest
-
- All Implemented Interfaces:
java.io.Serializable,DSOLModel<Time,Duration,SimTimeDoubleUnit,OTSSimulatorInterface>,DSOLModel.TimeDoubleUnit<OTSSimulatorInterface>,OTSModelInterface
public class PublisherTest extends java.lang.Object implements OTSModelInterface
Unit tests. This requires half of OTS in the imports because it sets up a simulation and runs that for a couple of seconds.Copyright (c) 2020-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.$LastChangedDate: 2020-02-13 11:08:16 +0100 (Thu, 13 Feb 2020) $, @version $Revision: 6383 $, by $Author: pknoppers $,
- Author:
- Peter Knoppers
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface nl.tudelft.simulation.dsol.model.DSOLModel
DSOLModel.CalendarDouble<S extends SimulatorInterface.CalendarDouble>, DSOLModel.CalendarFloat<S extends SimulatorInterface.CalendarFloat>, DSOLModel.CalendarLong<S extends SimulatorInterface.CalendarLong>, DSOLModel.TimeDouble<S extends SimulatorInterface.TimeDouble>, DSOLModel.TimeDoubleUnit<S extends SimulatorInterface.TimeDoubleUnit>, DSOLModel.TimeFloat<S extends SimulatorInterface.TimeFloat>, DSOLModel.TimeFloatUnit<S extends SimulatorInterface.TimeFloatUnit>, DSOLModel.TimeLong<S extends SimulatorInterface.TimeLong>
-
-
Constructor Summary
Constructors Constructor Description PublisherTest()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckLastResult(java.lang.String expectedText)Verify thatlastResultis not null, an Object array of length 1 and the one and only element is a String with the expected text.voidconstructModel()java.lang.StringgetDescription()InputParameterMapgetInputParameterMap()OTSNetworkgetNetwork()java.util.List<OutputStatistic<?>>getOutputStatistics()java.lang.StringgetShortName()OTSSimulatorInterfacegetSimulator()static java.lang.StringreadStringFromURL(java.net.URL url)Open an URL, read it and store the contents in a string.voidtestPublisher()Test the Publisher class.
-
-
-
Method Detail
-
testPublisher
public void testPublisher() throws java.rmi.RemoteException, NetworkException, OTSGeometryException, SimRuntimeException, javax.naming.NamingException, Sim0MQException, SerializationExceptionTest the Publisher class.- Throws:
java.rmi.RemoteException- when that happens this test has failedNetworkException- if that happens uncaught; this test has failedOTSGeometryException- if that happens uncaught; this test has failedjavax.naming.NamingException- on context errorSimRuntimeException- on DSOL errorSerializationException- - when encoding an error message failsSim0MQException- - when encoding an error message fails
-
checkLastResult
public void checkLastResult(java.lang.String expectedText)
Verify thatlastResultis not null, an Object array of length 1 and the one and only element is a String with the expected text.- Parameters:
expectedText- String; the expected text
-
constructModel
public void constructModel() throws SimRuntimeException- Specified by:
constructModelin interfaceDSOLModel<Time,Duration,SimTimeDoubleUnit,OTSSimulatorInterface>- Throws:
SimRuntimeException
-
getSimulator
public final OTSSimulatorInterface getSimulator()
- Specified by:
getSimulatorin interfaceDSOLModel<Time,Duration,SimTimeDoubleUnit,OTSSimulatorInterface>
-
getInputParameterMap
public final InputParameterMap getInputParameterMap()
- Specified by:
getInputParameterMapin interfaceDSOLModel<Time,Duration,SimTimeDoubleUnit,OTSSimulatorInterface>
-
getOutputStatistics
public final java.util.List<OutputStatistic<?>> getOutputStatistics()
- Specified by:
getOutputStatisticsin interfaceDSOLModel<Time,Duration,SimTimeDoubleUnit,OTSSimulatorInterface>
-
getNetwork
public final OTSNetwork getNetwork()
- Specified by:
getNetworkin interfaceOTSModelInterface
-
getShortName
public final java.lang.String getShortName()
- Specified by:
getShortNamein interfaceOTSModelInterface
-
getDescription
public final java.lang.String getDescription()
- Specified by:
getDescriptionin interfaceOTSModelInterface
-
readStringFromURL
public static java.lang.String readStringFromURL(java.net.URL url) throws java.io.IOExceptionOpen an URL, read it and store the contents in a string. Adapted from https://stackoverflow.com/questions/4328711/read-url-to-string-in-few-lines-of-java-code- Parameters:
url- URL; the URL- Returns:
- String
- Throws:
java.io.IOException- when reading the file fails
-
-