Class TestServer


  • public class TestServer
    extends java.lang.Object
    Implements an OPC UA embedded test server.
    Author:
    Holger Eichelberger, SSE
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private org.eclipse.milo.opcua.sdk.server.api.ManagedNamespaceWithLifecycle exampleNamespace  
      private org.slf4j.Logger logger  
      protected static boolean SECURE  
      private org.eclipse.milo.opcua.sdk.server.OpcUaServer server  
      private ServerSetup setup  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private org.eclipse.milo.opcua.stack.server.EndpointConfiguration buildHttpsEndpoint​(org.eclipse.milo.opcua.stack.server.EndpointConfiguration.Builder base)
      Builds an HTTPS endpoint for ServerSetup.getHttpsPort().
      private org.eclipse.milo.opcua.stack.server.EndpointConfiguration buildTcpEndpoint​(org.eclipse.milo.opcua.stack.server.EndpointConfiguration.Builder base)
      Builds a TCP endpoint for ServerSetup.getTcpPort().
      private java.util.Set<org.eclipse.milo.opcua.stack.server.EndpointConfiguration> createEndpointConfigurations()
      Creates the endpoint configurations.
      java.util.concurrent.CompletableFuture<org.eclipse.milo.opcua.sdk.server.OpcUaServer> shutdown()
      Shuts down the server.
      java.util.concurrent.CompletableFuture<org.eclipse.milo.opcua.sdk.server.OpcUaServer> startup()
      Starts the server.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logger

        private final org.slf4j.Logger logger
      • server

        private final org.eclipse.milo.opcua.sdk.server.OpcUaServer server
      • exampleNamespace

        private final org.eclipse.milo.opcua.sdk.server.api.ManagedNamespaceWithLifecycle exampleNamespace
    • Constructor Detail

      • TestServer

        public TestServer​(NamespaceCreator namespaceCreator,
                          ServerSetup setup)
                   throws java.util.concurrent.ExecutionException
        Creates a test server.
        Parameters:
        namespaceCreator - the namespace creator
        setup - the setup for the server
        Throws:
        java.util.concurrent.ExecutionException - if creating the server fails for some reason
    • Method Detail

      • createEndpointConfigurations

        private java.util.Set<org.eclipse.milo.opcua.stack.server.EndpointConfiguration> createEndpointConfigurations()
        Creates the endpoint configurations. setup implicitly defines the endpoints to be created and how to secure the endpoints.
        Returns:
        the endpoint configurations
      • buildTcpEndpoint

        private org.eclipse.milo.opcua.stack.server.EndpointConfiguration buildTcpEndpoint​(org.eclipse.milo.opcua.stack.server.EndpointConfiguration.Builder base)
        Builds a TCP endpoint for ServerSetup.getTcpPort().
        Parameters:
        base - the base configuration to be extended for HTTPS
        Returns:
        the endpoint configuration
      • buildHttpsEndpoint

        private org.eclipse.milo.opcua.stack.server.EndpointConfiguration buildHttpsEndpoint​(org.eclipse.milo.opcua.stack.server.EndpointConfiguration.Builder base)
        Builds an HTTPS endpoint for ServerSetup.getHttpsPort().
        Parameters:
        base - the base configuration to be extended for HTTPS
        Returns:
        the endpoint configuration
      • startup

        public java.util.concurrent.CompletableFuture<org.eclipse.milo.opcua.sdk.server.OpcUaServer> startup()
        Starts the server.
        Returns:
        the future on the start operation, just call CompletableFuture.get()
      • shutdown

        public java.util.concurrent.CompletableFuture<org.eclipse.milo.opcua.sdk.server.OpcUaServer> shutdown()
        Shuts down the server.
        Returns:
        the future on the start operation, just call CompletableFuture.get()