Debian Codegraph @

src/test/java/org/jboss/modules/MavenResource2Test.java

raw
1 /*
2 * JBoss, Home of Professional Open Source.
3 * Copyright 2014 Red Hat, Inc., and individual contributors
4 * as indicated by the @author tags.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * 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, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 package org.jboss.modules;
20
21 import org.jboss.modules.maven.MavenSettingsTest;
22 import org.jboss.modules.util.Util;
23 import org.junit.Assert;
24 import org.junit.Before;
25 import org.junit.Rule;
26 import org.junit.Test;
27 import org.junit.rules.TemporaryFolder;
28
29 import java.io.File;
30 import java.net.URL;
31
32 /**
33 * @author <a href="mailto:[email protected]">Bill Burke</a>
34 * @version $Revision: 1 $
35 */
36 public class MavenResource2Test {
37
38 protected static final String MODULE_ID2 = "test.maven:non-main";
39
40 private ModuleLoader moduleLoader;
41
42 @Before
43 public void setupRepo() throws Exception {
44 final File repoRoot = Util.getResourceFile(getClass(), "test/repo");
45 moduleLoader = new LocalModuleLoader(new File[]{repoRoot});
46 }
47
48 @Test
49 public void testDefaultRepositories() throws Exception {
50 try {
51 URL settingsXmlUrl = MavenSettingsTest.class.getResource("jboss-settings.xml");
52 System.setProperty("jboss.modules.settings.xml.url", settingsXmlUrl.toExternalForm());
53 Module module = moduleLoader.loadModule(MODULE_ID2);
54 URL url = module.getResource("org/jboss/resteasy/plugins/providers/jackson/ResteasyJacksonProvider.class");
55 System.out.println(url);
56 Assert.assertNotNull(url);
57 } finally {
58 System.clearProperty("jboss.modules.settings.xml.url");
59 }
60 }
61 }