2 * See the file LICENSE for redistribution information.
4 * Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
10 import org.junit.Before;
14 import java.net.URLClassLoader;
15 import java.util.Properties;
17 public abstract class AbstractUpgTest {
18 protected Object oldGroup_o, currentGroup_o;
19 private String currentScript, oldScript, oldVersion;
21 public AbstractUpgTest(String ov, String os, String cs) {
27 @Before public void create() throws Exception {
28 Properties p = new Properties();
29 p.load(getClass().getResourceAsStream("classpaths.properties"));
31 URL[] urls = new URL[2];
32 urls[0] = makeUrl(p.getProperty("db." + oldVersion));
33 urls[1] = makeUrl(p.getProperty("test." + oldVersion));
34 ClassLoader cl = new URLClassLoader(urls);
36 oldGroup_o = cl.loadClass(oldScript).newInstance();
38 urls[0] = makeUrl(p.getProperty("db"));
39 urls[1] = makeUrl(p.getProperty("test"));
40 cl = new URLClassLoader(urls);
41 currentGroup_o = cl.loadClass(currentScript).newInstance();
44 private URL makeUrl(String fileName) throws Exception {
45 return new File(fileName).toURI().toURL();