Package org.jboss.arquillian.container.spi

Examples of org.jboss.arquillian.container.spi.Container


   @Before
   public void createSetup()
   {
      ContainerRegistry reg = Mockito.mock(ContainerRegistry.class);
      Container container = Mockito.mock(Container.class);
      Mockito.when(container.getState()).thenReturn(State.STARTED);
      Mockito.when(container.getName()).thenReturn("_DEFAULT_");
      Container containerStopped = Mockito.mock(Container.class);
      Mockito.when(containerStopped.getState()).thenReturn(State.STOPPED);
      Mockito.when(containerStopped.getName()).thenReturn("_CONTAINER_STOPPED_");
     
      Mockito.when(reg.getContainer("_DEFAULT_")).thenReturn(container);
      Mockito.when(reg.getContainer("_CONTAINER_STOPPED_")).thenReturn(containerStopped);
      Mockito.when(reg.getContainer(new TargetDescription("_DEFAULT_"))).thenReturn(container);
      Mockito.when(reg.getContainer(new TargetDescription("_CONTAINER_STOPPED_"))).thenReturn(containerStopped);
View Full Code Here


     * @return
     * @throws IllegalArgumentException If no ResourceProvider found for Type
     * @throws RuntimeException         If ResourceProvider return null
     */
    private Object lookup(Class<?> type, ContainerResource resource, Annotation... qualifiers) {
        final Container container;
        final List<Container> containers = containerRegistry.get().getContainers();
        if (resource.value().isEmpty()) {
            if (containers.size() > 1) {
                throw new RuntimeException("@ContainerResource did not specify a server and more than one server exists in the deployment");
            }
            container = containers.get(0);
        } else {
            container = containerRegistry.get().getContainer(resource.value());
            if (container == null) {
                throw new RuntimeException("@ContainerResource specified non existent server " + resource.value());
            }
        }
        try {
            containerContext.get().activate(container.getName());
            if (Context.class.isAssignableFrom(type)) {
                return lookupContext(type, resource, qualifiers);
            } else if (ManagementClient.class.isAssignableFrom(type)) {
                return managementClient.get();
            } else {
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.container.spi.Container

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.