1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   * 
19   * Author: Siamak Haschemi
20   * Contact: haschemi@informatik.hu-berlin.de
21   */
22  package net.sourceforge.osgi.deployment.maven.mojo;
23  
24  import net.sourceforge.osgi.deployment.maven.container.BundleResource;
25  import net.sourceforge.osgi.deployment.maven.manifest.DeploymentPackageManifest;
26  import junit.framework.TestCase;
27  
28  /**
29   * @author Siamak Haschemi, haschemi@informatik.hu-berlin.de
30   * 
31   */
32  public class DeploymentPackageManifestTest extends TestCase {
33  
34    /**
35     * Test method for
36     * {@link net.sourceforge.osgi.deployment.maven.DeploymentPlugin#execute(de.hu_berlin.metrik.osgi.deployment.mojo.DeploymentPluginMojoContext)}.
37     */
38    public final void testExecute() {
39      // fail("Not yet implemented"); // TODO
40    }
41  
42    /**
43     * Test method for {@link net.sourceforge.osgi.deployment.maven.DeploymentPlugin#resolveBundleResource(DeploymentPluginMojoContext, BundleResource)}.
44     */
45    public final void testResolveBundleResource() {
46      // fail("Not yet implemented"); // TODO
47    }
48  
49    /**
50     * Test method for {@link net.sourceforge.osgi.deployment.maven.DeploymentPlugin#isVersion(java.lang.String)}.
51     */
52    public final void testIsVersion() {
53  //    assertFalse(DeploymentPackageManifest.isVersion(""));
54  //    assertFalse(DeploymentPackageManifest.isVersion(null));
55  //    assertTrue(DeploymentPackageManifest.isVersion("1.0.0"));
56  //    assertTrue(DeploymentPackageManifest.isVersion("1"));
57  //    assertTrue(DeploymentPackageManifest.isVersion("1.0"));
58  //    assertTrue(DeploymentPackageManifest.isVersion("1.0.0.BLUB"));
59    }
60  
61    /**
62     * Test method for {@link net.sourceforge.osgi.deployment.maven.DeploymentPlugin#isUniqueName(java.lang.String)}.
63     */
64    public final void testIsUniqueName() {
65      // fail("Not yet implemented"); // TODO
66    }
67  
68    /**
69     * Test method for {@link net.sourceforge.osgi.deployment.maven.DeploymentPlugin#isResourceId(java.lang.String)}.
70     */
71    public final void testIsResourceId() {
72      assertFalse(DeploymentPackageManifest.isResourceId(null));
73      assertFalse(DeploymentPackageManifest.isResourceId(""));
74      assertFalse(DeploymentPackageManifest.isResourceId(" "));
75      assertTrue(DeploymentPackageManifest.isResourceId("A"));
76      assertTrue(DeploymentPackageManifest.isResourceId("a"));
77      assertTrue(DeploymentPackageManifest.isResourceId("AA"));
78      assertTrue(DeploymentPackageManifest.isResourceId("aa"));
79      assertTrue(DeploymentPackageManifest.isResourceId("Aa"));
80      assertTrue(DeploymentPackageManifest.isResourceId("Z"));
81      assertTrue(DeploymentPackageManifest.isResourceId("z"));
82      assertTrue(DeploymentPackageManifest.isResourceId("a.b"));
83      assertTrue(DeploymentPackageManifest.isResourceId("a.b.c"));
84      assertTrue(DeploymentPackageManifest.isResourceId("a.0.a"));
85      assertTrue(DeploymentPackageManifest.isResourceId("a.0./a"));
86      assertTrue(DeploymentPackageManifest.isResourceId("a./0/_.a"));
87      assertTrue(DeploymentPackageManifest.isResourceId("a./0/_.a"));
88      assertTrue(DeploymentPackageManifest.isResourceId("/"));
89      assertTrue(DeploymentPackageManifest.isResourceId("////"));
90      assertTrue(DeploymentPackageManifest.isResourceId("/a/b/c/1/_/-/./a/a/a/"));
91      assertTrue(DeploymentPackageManifest.isResourceId("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.-/"));
92    }
93  
94  }