Debian Codegraph @

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

raw
1 /*
2 * JBoss, Home of Professional Open Source.
3 * Copyright 2017 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 java.io.File;
22 import java.net.URL;
23
24 import org.jboss.modules.util.Util;
25 import org.junit.Assert;
26 import org.junit.Before;
27 import org.junit.Test;
28
29 /**
30 * @author <a href="mailto:[email protected]">David M. Lloyd</a>
31 */
32 public class FileSystemClassPathModuleLoaderTest {
33 private FileSystemClassPathModuleFinder moduleFinder;
34 private ModuleLoader moduleLoader;
35
36 @Before
37 public void setup() throws Exception {
38 final File repoRoot = Util.getResourceFile(getClass(), "test/repo");
39 ModuleLoader localModuleLoader = new LocalModuleLoader(new File[] {repoRoot});
40 moduleFinder = new FileSystemClassPathModuleFinder(localModuleLoader);
41 moduleLoader = new ModuleLoader(moduleFinder);
42 }
43
44 @Test
45 public void testModuleLoadFromFileSystemModule() throws Exception {
46 final File resourceFile = Util.getResourceFile(getClass(), "test/filesystem-module-1");
47 final Module module = moduleLoader.loadModule(resourceFile.getAbsoluteFile().getCanonicalFile().toString());
48 final URL exportedResource = module.getExportedResource("META-INF/services/javax.ws.rs.ext.Providers");
49 Assert.assertNotNull(exportedResource);
50 }
51 }