aslak

Arquillian - Beta1 - Rough API

Oct 14th, 2010
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.80 KB | None | 0 0
  1. /*
  2.  * JBoss, Home of Professional Open Source
  3.  * Copyright 2010, Red Hat Middleware LLC, and individual contributors
  4.  * by the @authors tag. See the copyright.txt in the distribution for a
  5.  * full listing of individual contributors.
  6.  *
  7.  * Licensed under the Apache License, Version 2.0 (the "License");
  8.  * you may not use this file except in compliance with the License.
  9.  * You may obtain a copy of the License at
  10.  * http://www.apache.org/licenses/LICENSE-2.0
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.jboss.arquillian.api;
  18.  
  19. import org.jboss.shrinkwrap.api.ShrinkWrap;
  20. import org.jboss.shrinkwrap.api.spec.JavaArchive;
  21. import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;
  22.  
  23. /**
  24.  * APITestCase
  25.  *
  26.  * @author <a href="mailto:[email protected]">Aslak Knutsen</a>
  27.  * @version $Revision: $
  28.  */
  29. @RunWith(Arquillian.class)
  30. public class APITestCase
  31. {
  32.    // Deploy on startup a Resource Adaptor
  33.    @Target("frontend-container")
  34.    @Deployment(order = 1)  // optional deployment order if multiple startup = true deployments defined
  35.    public static ResourceAdapterArchive createFront()
  36.    {
  37.       return ShrinkWrap.create(ResourceAdapterArchive.class);
  38.    }
  39.  
  40.    // Deploy on startup a Resource Adaptor Configuration
  41.    @Target("frontend-container")
  42.    @Deployment(order = 2)  // optional deployment order if multiple startup = true deployments defined
  43.    public static Descriptor createFrontDescriptor()
  44.    {
  45.       return Descriptors.create(ResourceAdaptorDescriptor.class);
  46.    }
  47.  
  48.    @Protocol("EJB") // will override default defined protocol and prepare this with the EJB protocol
  49.    @Target("backend-container")  // required if multiple active containers, specifies which container to deploy to
  50.    @Deployment(
  51.          name = "backend", // identify the deployment, used to manually deploy using the Deployer API
  52.          startup = false) // do not automatically deploy
  53.    public static JavaArchive createBackend()
  54.    {
  55.       return ShrinkWrap.create(JavaArchive.class);
  56.    }
  57.  
  58.    @ArquillianResource
  59.    private Deployer deployer;
  60.    
  61.    @Test // will target the default container
  62.    public void shouldBeExecutedOnTheDefaultContainer()
  63.    {
  64.       deployer.deploy("backend"); // will do a callback to the client and ask it to deploy a named deployment to the deployments target container
  65.    }
  66.  
  67.    @Target("backend-container") // method will be executed on the backend-container, using the backend-container defined protocol
  68.    @Test
  69.    public void shouldBeExecutedOnTheBackendContainer()
  70.    {
  71.      
  72.    }
  73. }
Add Comment
Please, Sign In to add comment