Search in sources :

Example 21 with Server

use of org.apache.cxf.endpoint.Server in project cxf by apache.

the class ServerRegistryImpl method preShutdown.

@PreDestroy
public void preShutdown() {
    // Shutdown the service.
    // To avoid the CurrentModificationException, do not use serversList directly
    Object[] servers = serversList.toArray();
    for (int i = 0; i < servers.length; i++) {
        Server server = (Server) servers[i];
        server.destroy();
    }
}
Also used : Server(org.apache.cxf.endpoint.Server) PreDestroy(javax.annotation.PreDestroy)

Example 22 with Server

use of org.apache.cxf.endpoint.Server in project cxf by apache.

the class EndpointReferenceUtils method getMatchingMultiplexDestination.

private static MultiplexDestination getMatchingMultiplexDestination(QName serviceQName, String portName, Bus bus) {
    MultiplexDestination destination = null;
    ServerRegistry serverRegistry = bus.getExtension(ServerRegistry.class);
    if (null != serverRegistry) {
        List<Server> servers = serverRegistry.getServers();
        for (Server s : servers) {
            QName targetServiceQName = s.getEndpoint().getEndpointInfo().getService().getName();
            if (serviceQName.equals(targetServiceQName) && portNameMatches(s, portName)) {
                Destination dest = s.getDestination();
                if (dest instanceof MultiplexDestination) {
                    destination = (MultiplexDestination) dest;
                    break;
                }
            }
        }
    } else {
        LOG.log(Level.WARNING, "Failed to locate service matching " + serviceQName + ", because the bus ServerRegistry extension provider is null");
    }
    return destination;
}
Also used : Destination(org.apache.cxf.transport.Destination) MultiplexDestination(org.apache.cxf.transport.MultiplexDestination) Server(org.apache.cxf.endpoint.Server) QName(javax.xml.namespace.QName) ServerRegistry(org.apache.cxf.endpoint.ServerRegistry) MultiplexDestination(org.apache.cxf.transport.MultiplexDestination)

Example 23 with Server

use of org.apache.cxf.endpoint.Server in project cxf by apache.

the class ServerRegistryImpTest method testServerRegistryPreShutdown.

@Test
public void testServerRegistryPreShutdown() {
    ServerRegistryImpl serverRegistryImpl = new ServerRegistryImpl();
    Server server = new DummyServer(serverRegistryImpl);
    server.start();
    assertEquals("The serverList should have one service", serverRegistryImpl.serversList.size(), 1);
    serverRegistryImpl.preShutdown();
    assertEquals("The serverList should be clear ", serverRegistryImpl.serversList.size(), 0);
    serverRegistryImpl.postShutdown();
    assertEquals("The serverList should be clear ", serverRegistryImpl.serversList.size(), 0);
}
Also used : Server(org.apache.cxf.endpoint.Server) DummyServer(org.apache.cxf.endpoint.DummyServer) DummyServer(org.apache.cxf.endpoint.DummyServer) Test(org.junit.Test)

Example 24 with Server

use of org.apache.cxf.endpoint.Server in project cxf by apache.

the class TypeCreationOptionsSpringTest method testMinOccurs.

@Test
public void testMinOccurs() throws Exception {
    TestUtilities testUtilities = new TestUtilities(TypeCreationOptionsSpringTest.class);
    testUtilities.setBus(getBean(Bus.class, "cxf"));
    testUtilities.addDefaultNamespaces();
    testUtilities.addNamespace("ts", "http://cxf.org.apache/service");
    // {urn:org.apache.cxf.aegis}arrayService
    Server s = testUtilities.getServerForService(new QName("urn:org.apache.cxf.aegis", "arrayService"));
    Document wsdl = testUtilities.getWSDLDocument(s);
    assertXPathEquals("//xsd:complexType[@name='ArrayOfInt']/" + "xsd:sequence/xsd:element[@name='int']/@minOccurs", "3", wsdl);
}
Also used : Bus(org.apache.cxf.Bus) Server(org.apache.cxf.endpoint.Server) QName(javax.xml.namespace.QName) TestUtilities(org.apache.cxf.test.TestUtilities) Document(org.w3c.dom.Document) AbstractCXFSpringTest(org.apache.cxf.test.AbstractCXFSpringTest) Test(org.junit.Test)

Example 25 with Server

use of org.apache.cxf.endpoint.Server in project cxf by apache.

the class AnnotatedTypeTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    Server s = createService(AnnotatedService.class);
    service = s.getEndpoint().getService();
    databinding = (AegisDatabinding) service.getDataBinding();
    tm = databinding.getAegisContext().getTypeMapping();
}
Also used : Server(org.apache.cxf.endpoint.Server) Before(org.junit.Before)

Aggregations

Server (org.apache.cxf.endpoint.Server)199 Test (org.junit.Test)119 ReferenceParametersType (org.apache.cxf.ws.addressing.ReferenceParametersType)54 ResourceManager (org.apache.cxf.ws.transfer.manager.ResourceManager)52 MemoryResourceManager (org.apache.cxf.ws.transfer.manager.MemoryResourceManager)50 Resource (org.apache.cxf.ws.transfer.resource.Resource)50 ExpressionType (org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType)47 ValueType (org.apache.cxf.ws.transfer.dialect.fragment.ValueType)44 Element (org.w3c.dom.Element)44 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)33 Put (org.apache.cxf.ws.transfer.Put)33 Fragment (org.apache.cxf.ws.transfer.dialect.fragment.Fragment)32 Service (org.apache.cxf.service.Service)27 Bus (org.apache.cxf.Bus)25 PutResponse (org.apache.cxf.ws.transfer.PutResponse)25 Endpoint (org.apache.cxf.endpoint.Endpoint)21 ArrayList (java.util.ArrayList)18 QName (javax.xml.namespace.QName)18 ServerRegistry (org.apache.cxf.endpoint.ServerRegistry)18 Document (org.w3c.dom.Document)18