View Javadoc
1   /*
2    * Copyright (c) 2016 ingenieux Labs
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package br.com.ingenieux.mojo.beanstalk;
18  
19  import com.amazonaws.services.s3.AmazonS3Client;
20  import com.amazonaws.services.s3.model.S3Object;
21  
22  import org.junit.Ignore;
23  import org.junit.internal.runners.JUnit38ClassRunner;
24  import org.junit.runner.RunWith;
25  
26  import java.io.File;
27  
28  @Ignore
29  @RunWith(JUnit38ClassRunner.class)
30  public class BootstrapTest extends BeanstalkTestBase {
31  
32    private String s3Key;
33    private String s3Bucket;
34    private File artifactFile;
35  
36    @Override
37    protected void setUp() throws Exception {
38      super.setUp();
39  
40      artifactFile = getWarFile();
41      s3Bucket = getS3Bucket();
42      s3Key = getS3Path();
43  
44      setVariableValueToObject(uploadSourceBundleMojo, "artifactFile", artifactFile);
45      setVariableValueToObject(uploadSourceBundleMojo, "s3Bucket", s3Bucket);
46      setVariableValueToObject(uploadSourceBundleMojo, "s3Key", s3Key);
47  
48      setVariableValueToObject(createAppVersionMojo, "versionLabel", this.versionLabel);
49    }
50  
51    public void testUploadSourceBundle() throws Exception {
52      uploadSourceBundleMojo.execute();
53  
54      AmazonS3Client s3Client = new AmazonS3Client(this.credentials);
55  
56      S3Object object = s3Client.getObject(s3Bucket, s3Key);
57  
58      assertNotNull(object);
59      assertEquals(object.getObjectMetadata().getContentLength(), artifactFile.length());
60    }
61  
62    public void testCreateApplicationVersion() throws Exception {
63      createAppVersionMojo.execute();
64    }
65  
66    public void testCreateConfigurationTemplate() throws Exception {
67      createConfigurationTemplateMojo.execute();
68    }
69  
70    public void testDeployment() throws Exception {}
71  }