1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package com.github.maven_nar.test;
21
22 import java.io.File;
23
24 import junit.framework.Assert;
25 import junit.framework.TestCase;
26
27 import org.apache.maven.plugin.MojoExecutionException;
28 import org.apache.maven.plugin.MojoFailureException;
29 import org.apache.maven.plugin.logging.Log;
30 import org.apache.maven.plugin.logging.SystemStreamLog;
31
32 import com.github.maven_nar.AbstractNarLayout;
33 import com.github.maven_nar.Library;
34 import com.github.maven_nar.NarFileLayout;
35 import com.github.maven_nar.NarFileLayout10;
36 import com.github.maven_nar.NarLayout;
37 import com.github.maven_nar.NarLayout20;
38
39
40
41
42 public class TestNarLayout20 extends TestCase {
43 private NarFileLayout fileLayout;
44
45 private Log log;
46
47 private NarLayout layout;
48
49 private File baseDir;
50
51 private String aol;
52
53 private String type;
54
55
56
57
58
59
60 @Override
61 protected void setUp() throws Exception {
62 this.log = new SystemStreamLog();
63 this.fileLayout = new NarFileLayout10();
64 this.layout = new NarLayout20(this.log);
65 this.baseDir = new File("/Users/maven");
66 this.aol = "x86_64-MacOSX-g++";
67 this.type = Library.SHARED;
68 }
69
70
71
72
73
74
75
76
77
78 public final void testGetBinDirectory() throws MojoExecutionException, MojoFailureException {
79 Assert.assertEquals(new File(this.baseDir, this.fileLayout.getBinDirectory(this.aol)),
80 this.layout.getBinDirectory(this.baseDir, null, null, this.aol));
81 }
82
83
84
85
86
87
88
89
90 public final void testGetIncludeDirectory() throws MojoExecutionException, MojoFailureException {
91 Assert.assertEquals(new File(this.baseDir, this.fileLayout.getIncludeDirectory()),
92 this.layout.getIncludeDirectory(this.baseDir, null, null));
93 }
94
95 public final void testGetLayout() throws MojoExecutionException {
96 AbstractNarLayout.getLayout("NarLayout20", this.log);
97 }
98
99
100
101
102
103
104
105
106
107 public final void testGetLibDirectory() throws MojoExecutionException, MojoFailureException {
108 Assert.assertEquals(new File(this.baseDir, this.fileLayout.getLibDirectory(this.aol, this.type)),
109 this.layout.getLibDirectory(this.baseDir, null, null, this.aol, this.type));
110 }
111 }