View Javadoc

1   /*
2    * #%L
3    * Native ARchive plugin for Maven
4    * %%
5    * Copyright (C) 2002 - 2014 NAR Maven Plugin developers.
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   * 
11   * http://www.apache.org/licenses/LICENSE-2.0
12   * 
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   * #L%
19   */
20  package com.github.maven_nar.test;
21  
22  import junit.framework.Assert;
23  import junit.framework.TestCase;
24  
25  import com.github.maven_nar.Linker;
26  import com.github.maven_nar.NarProperties;
27  import com.github.maven_nar.NarUtil;
28  
29  /**
30   * @author Mark Donszelmann (Mark.Donszelmann@gmail.com)
31   * @version $Id$
32   */
33  public class TestLinkerVersion extends TestCase {
34    private Linker linker;
35  
36    /*
37     * (non-Javadoc)
38     * 
39     * @see junit.framework.TestCase#setUp()
40     */
41    @Override
42    protected void setUp() throws Exception {
43      super.setUp();
44      final String architecture = System.getProperty("os.arch");
45      this.linker = new Linker();
46      // String name =
47      this.linker.getName(NarProperties.getInstance(null),
48          NarUtil.getArchitecture(architecture) + "." + NarUtil.getOS(null) + ".");
49    }
50  
51    public void testVersion() throws Exception {
52      if ("Windows".equals(NarUtil.getOS(null)) && null == System.getenv("DevEnvDir")) {
53        // Skip testing the MSVC linker on Win if vsvars32.bat has not run
54        return;
55      }
56      final String version = this.linker.getVersion();
57      Assert.assertNotNull(version);
58    }
59  
60  }