Debian Codegraph @

maven-packager-utils/src/test/java/org/debian/maven/packager/util/GetPackageResultTest.java

raw
1 /*
2 * Copyright 2012 Ludovic Claude.
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 org.debian.maven.packager.util;
18
19 import static org.junit.Assert.assertEquals;
20
21 import java.util.ArrayList;
22 import java.util.List;
23
24 import org.junit.Test;
25
26 public class GetPackageResultTest {
27
28 private GetPackageResult result = new GetPackageResult();
29
30 @Test
31 public void testFilterDpkgOutputFindCommonsIoPom() throws Exception {
32 //dpkg --search /usr/share/maven-repo/commons-io/commons-io/1.4/commons-io-1.4.pom
33 List<String> dpkgOut = new ArrayList<String>();
34 dpkgOut.add("libcommons-io-java: /usr/share/maven-repo/commons-io/commons-io/1.4/commons-io-1.4.pom");
35
36 for (String line : dpkgOut) {
37 result.newLine(line);
38 }
39 assertEquals(1, result.getResult().size());
40 assertEquals("libcommons-io-java", result.getResult().iterator().next());
41 }
42
43 @Test
44 public void testFilterDpkgOutputFindAnyJavaccMavenPlugin() throws Exception {
45 //dpkg --search /usr/share/maven-repo/org/codehaus/mojo/javacc-maven-plugin/*/*
46 List<String> dpkgOut = new ArrayList<String>();
47 dpkgOut.add("libjavacc-maven-plugin-java: /usr/share/maven-repo/org/codehaus/mojo/javacc-maven-plugin/2.6/javacc-maven-plugin-2.6.jar");
48 dpkgOut.add("libjavacc-maven-plugin-java: /usr/share/maven-repo/org/codehaus/mojo/javacc-maven-plugin/2.6/javacc-maven-plugin-2.6.pom");
49
50 for (String line : dpkgOut) {
51 result.newLine(line);
52 }
53 assertEquals(1, result.getResult().size());
54 assertEquals("libjavacc-maven-plugin-java", result.getResult().iterator().next());
55 }
56
57 @Test
58 public void testFilterAptFileOutput() throws Exception {
59 // apt-file search /usr/share/maven-repo/org/codehaus/mojo/javacc-maven-plugin/
60 List<String> dpkgOut = new ArrayList<String>();
61 dpkgOut.add("libjavacc-maven-plugin-java: /usr/share/maven-repo/org/codehaus/mojo/javacc-maven-plugin/2.6/javacc-maven-plugin-2.6.jar");
62 dpkgOut.add("libjavacc-maven-plugin-java: /usr/share/maven-repo/org/codehaus/mojo/javacc-maven-plugin/2.6/javacc-maven-plugin-2.6.pom");
63
64 for (String line : dpkgOut) {
65 result.newLine(line);
66 }
67 assertEquals(1, result.getResult().size());
68 assertEquals("libjavacc-maven-plugin-java", result.getResult().iterator().next());
69 }
70
71 }