Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.97 KB | None | 0 0
  1. package org.jboss.qa.jenkins.jobs.quickstarts;
  2.  
  3. import static org.jboss.qa.phaser.ExceptionHandling.Execution.IMMEDIATELY_STOP;
  4. import static org.jboss.qa.phaser.ExceptionHandling.Report.THROW_AT_END;
  5.  
  6. import static org.junit.Assert.assertEquals;
  7.  
  8. import org.jboss.qa.jcontainer.fuse.FuseClient;
  9. import org.jboss.qa.jenkins.test.executor.beans.Destination;
  10. import org.jboss.qa.jenkins.test.executor.phase.staticconfiguration.StaticConfiguration;
  11. import org.jboss.qa.jenkins.test.executor.utils.MavenCli;
  12. import org.jboss.qa.jenkins.utils.JobUtils;
  13. import org.jboss.qa.jenkins.utils.wrappers.ClientWrapper;
  14. import org.jboss.qa.phaser.Create;
  15. import org.jboss.qa.phaser.Inject;
  16. import org.jboss.qa.phaser.OnException;
  17.  
  18. import java.io.File;
  19.  
  20. import lombok.extern.slf4j.Slf4j;
  21.  
  22. @Slf4j
  23. public abstract class QuickstartBase {
  24.  
  25.     protected File quickstartDir;
  26.     protected final static int STATIC_CONFIG_CREATE_SQDIR = 1;
  27.     protected final static int STATIC_CONFIG_BEFORE_QS_BUILD = 2;
  28.     protected final static int STATIC_CONFIG_QA_BUILD = 3;
  29.  
  30.     @Inject(id = "container-home")
  31.     protected Destination fuseHome;
  32.  
  33.     @Inject
  34.     protected ClientWrapper clientWrapper;
  35.  
  36.     protected FuseClient getClient() {
  37.         return (FuseClient) clientWrapper.getClient();
  38.     }
  39.  
  40.     @StaticConfiguration(download = "container", order = STATIC_CONFIG_CREATE_SQDIR)
  41.     public void createQuickstartDirs() throws Exception {
  42.         quickstartDir = new File(fuseHome.getDestination(), getRelativeQuickstartHomePath());
  43.     }
  44.  
  45.     @StaticConfiguration(download = "container", order = STATIC_CONFIG_QA_BUILD)
  46.     @OnException(execution = IMMEDIATELY_STOP, report = THROW_AT_END)
  47.     public void buildQuickstart(@Create MavenCli.Builder builder) throws Exception {
  48.         JobUtils.initMavenBuilder(builder, new File(quickstartDir, "pom.xml")).goals("clean", "install");
  49.         final int exitCode = builder.build().run();
  50.         assertEquals("Quickstart was not built", 0, exitCode);
  51.     }
  52.  
  53.     protected abstract String getRelativeQuickstartHomePath();
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement