forked from arquillian/arquillian-container-osgi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ARQ-1780] Fix parsing of import-export packages in class AbstractOSG…
…iApplicationArchiveProcessor
- Loading branch information
Martin Basovnik
authored and
Thomas Diesler
committed
May 21, 2014
1 parent
b2dce9e
commit 3986a1e
Showing
2 changed files
with
101 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
...jboss/test/arquillian/container/osgi/AbstractOSGiApplicationArchiveProcessorTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2009, Red Hat Middleware LLC, and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.jboss.test.arquillian.container.osgi; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
import java.lang.reflect.Method; | ||
import java.util.Arrays; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.jboss.arquillian.container.osgi.AbstractOSGiApplicationArchiveProcessor; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Test {@link AbstractOSGiApplicationArchiveProcessor} | ||
* | ||
* @author mbasovni@redhat.com | ||
* @since 19-May-2014 | ||
*/ | ||
public class AbstractOSGiApplicationArchiveProcessorTestCase { | ||
|
||
@Test | ||
public void splitWithComma() throws Exception { | ||
Map<String, List<String>> map = new HashMap<String, List<String>>(); | ||
map.put( | ||
"org.jboss.arquillian.junit", | ||
Arrays.asList("org.jboss.arquillian.junit") | ||
); | ||
map.put( | ||
"org.jboss.arquillian.junit,org.junit.runner,org.osgi.framework", | ||
Arrays.asList("org.jboss.arquillian.junit", "org.junit.runner", "org.osgi.framework") | ||
); | ||
map.put( | ||
"org.junit.runner;version=\"[0.0.0,5.0.0)\"", | ||
Arrays.asList("org.junit.runner;version=\"[0.0.0,5.0.0)\"") | ||
); | ||
map.put( | ||
"org.junit.runner;version=\"[0.0.0,5.0.0)\",org.jboss.arquillian.junit", | ||
Arrays.asList("org.junit.runner;version=\"[0.0.0,5.0.0)\"", "org.jboss.arquillian.junit") | ||
); | ||
map.put( | ||
"org.jboss.arquillian.junit;version=\"[0.0.0,3.0.0)\",org.junit.runner;version=\"[0.0.0,5.0.0)\"", | ||
Arrays.asList("org.jboss.arquillian.junit;version=\"[0.0.0,3.0.0)\"", "org.junit.runner;version=\"[0.0.0,5.0.0)\"") | ||
); | ||
map.put( | ||
"org.jboss.arquillian.junit;version=\"[0.0.0,3.0.0)\";extra=\"A,B\"", | ||
Arrays.asList("org.jboss.arquillian.junit;version=\"[0.0.0,3.0.0)\";extra=\"A,B\"") | ||
); | ||
map.put( | ||
"org.jboss.arquillian.junit;extra=\"A,B,C\",org.osgi.framework;version=\"[1.0.0,2.0.0)\"", | ||
Arrays.asList("org.jboss.arquillian.junit;extra=\"A,B,C\"", "org.osgi.framework;version=\"[1.0.0,2.0.0)\"") | ||
); | ||
for (Map.Entry<String,List<String>> entry : map.entrySet()) { | ||
assertTrue("Packages are not split correctly", splitWithComma(entry.getKey()).equals(entry.getValue())); | ||
} | ||
} | ||
|
||
private static List<String> splitWithComma(String value) throws Exception{ | ||
Method method = AbstractOSGiApplicationArchiveProcessor.class.getDeclaredMethod("splitWithComma", String.class); | ||
method.setAccessible(true); | ||
return Arrays.asList((String [])method.invoke(null, value)); | ||
} | ||
} |