View Javadoc

1   package org.apache.maven.it;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.util.Arrays;
23  
24  import junit.framework.TestCase;
25  
26  public class VerifierTest
27      extends TestCase
28  {
29      private void check( String expected, String... lines )
30      {
31          assertEquals( expected, ForkedLauncher.extractMavenVersion( Arrays.asList( lines ) ) );
32      }
33  
34      public void testExtractMavenVersion()
35      {
36          check( "2.0.6", "Maven version: 2.0.6" );
37  
38          check( "2.0.10", "Maven version: 2.0.10", "Java version: 1.5.0_22",
39                 "OS name: \"windows 7\" version: \"6.1\" arch: \"x86\" Family: \"windows\"" );
40  
41          check( "3.0", "Apache Maven 3.0 (r1004208; 2010-10-04 13:50:56+0200)", "Java version: 1.5.0_22",
42                 "OS name: \"windows 7\" version: \"6.1\" arch: \"x86\" Family: \"windows\"" );
43  
44          check( "3.0.5", "Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:28+0100)",
45                 "Java version: 1.7.0_25",
46                 "OS name: \"linux\" version: \"3.11.0-13-generic\" arch: \"amd64\" Family: \"unix\"" );
47  
48          check( "3.2-SNAPSHOT",
49                 "Apache Maven with Log4j 2 3.2-SNAPSHOT (bc5e99f9f0aaf7d5b2431ff5d602ca3bb38559d5; 2013-11-25 21:17:33+0100)",
50                 "Java version: 1.7.0_25",
51                 "OS name: \"linux\" version: \"3.11.0-13-generic\" arch: \"amd64\" Family: \"unix\"" );
52      }
53  
54      public void testFileInJarPresent()
55          throws VerificationException
56      {
57          //File file = new File( "src/test/resources/mshared104.jar!fud.xml" );
58          Verifier verifier = new Verifier( "src/test/resources" );
59          verifier.assertFilePresent( "mshared104.jar!/pom.xml" );
60          verifier.assertFileNotPresent( "mshared104.jar!/fud.xml" );
61      }
62  
63  }