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.NarConstants;
35 import com.github.maven_nar.NarFileLayout;
36 import com.github.maven_nar.NarFileLayout10;
37 import com.github.maven_nar.NarLayout;
38 import com.github.maven_nar.NarLayout21;
39
40
41
42
43 public class TestNarLayout21 extends TestCase {
44 private NarFileLayout fileLayout;
45
46 private Log log;
47
48 private NarLayout layout;
49
50 private File baseDir;
51
52 private String artifactId;
53
54 private String version;
55
56 private String aol;
57
58 private String type;
59
60
61
62
63
64
65 @Override
66 protected void setUp() throws Exception {
67 this.fileLayout = new NarFileLayout10();
68 this.artifactId = "artifactId";
69 this.version = "version";
70 this.baseDir = new File("/Users/maven");
71 this.aol = "x86_64-MacOSX-g++";
72 this.type = Library.SHARED;
73
74 this.log = new SystemStreamLog();
75 this.layout = new NarLayout21(this.log);
76 }
77
78
79
80
81
82
83
84
85
86 public final void testGetBinDirectory() throws MojoExecutionException, MojoFailureException {
87 Assert.assertEquals(new File(this.baseDir, this.artifactId + "-" + this.version + "-" + this.aol + "-"
88 + "executable" + File.separator + this.fileLayout.getBinDirectory(this.aol)),
89 this.layout.getBinDirectory(this.baseDir, this.artifactId, this.version, this.aol));
90 }
91
92
93
94
95
96
97
98
99 public final void testGetIncludeDirectory() throws MojoExecutionException, MojoFailureException {
100 Assert.assertEquals(new File(this.baseDir, this.artifactId + "-" + this.version + "-" + NarConstants.NAR_NO_ARCH
101 + File.separator + this.fileLayout.getIncludeDirectory()),
102 this.layout.getIncludeDirectory(this.baseDir, this.artifactId, this.version));
103 }
104
105 public final void testGetLayout() throws MojoExecutionException {
106 AbstractNarLayout.getLayout("NarLayout21", this.log);
107 }
108
109
110
111
112
113
114
115
116
117 public final void testGetLibDirectory() throws MojoExecutionException, MojoFailureException {
118 Assert.assertEquals(new File(this.baseDir, this.artifactId + "-" + this.version + "-" + this.aol + "-" + this.type
119 + File.separator + this.fileLayout.getLibDirectory(this.aol, this.type)),
120 this.layout.getLibDirectory(this.baseDir, this.artifactId, this.version, this.aol, this.type));
121 }
122 }