@Override protected void setUp() throws Exception { tmp = IO.getFile("generated/tmp"); tmp.mkdirs(); configuration = new HashMap<String, Object>(); configuration.put( Constants.FRAMEWORK_STORAGE_CLEAN, Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT); configuration.put(Constants.FRAMEWORK_STORAGE, new File(tmp, "fwstorage").getAbsolutePath()); configuration.put( Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, "org.osgi.framework.launch;version=1.4"); framework = new org.apache.felix.framework.FrameworkFactory().newFramework(configuration); framework.init(); framework.start(); BundleContext context = framework.getBundleContext(); String[] bundles = { "../cnf/repo/osgi.cmpn/osgi.cmpn-4.3.1.jar", "testdata/slf4j-simple-1.7.12.jar", "testdata/slf4j-api-1.7.12.jar", "testdata/org.apache.aries.util-1.1.0.jar", "testdata/org.apache.aries.jmx-1.1.1.jar", "generated/biz.aQute.remote.test.jmx.jar" }; for (String bundle : bundles) { String location = "reference:" + IO.getFile(bundle).toURI().toString(); Bundle b = context.installBundle(location); if (!bundle.contains("slf4j-simple")) { b.start(); } } super.setUp(); }
/** * Get a reference to the basic IM operation set. * * @throws Exception if this is not a good day. */ protected void setUp() throws Exception { super.setUp(); fixture.setUp(); Map supportedOperationSets = fixture.provider.getSupportedOperationSets(); if (supportedOperationSets == null || supportedOperationSets.size() < 1) throw new NullPointerException( "No OperationSet implementations are supported by " + "this ICQ implementation. "); // get the operation set presence here. opSetBasicIM = (OperationSetBasicInstantMessaging) supportedOperationSets.get(OperationSetBasicInstantMessaging.class.getName()); // if the op set is null then the implementation doesn't offer a typing. // operation set which is unacceptable for icq. if (opSetBasicIM == null) { throw new NullPointerException("No implementation for basic IM was found"); } // we also need the presence op set in order to retrieve contacts. opSetPresence = (OperationSetPresence) supportedOperationSets.get(OperationSetPresence.class.getName()); // if the op set is null show that we're not happy. if (opSetPresence == null) { throw new NullPointerException( "An implementation of the ICQ service must provide an " + "implementation of at least one of the PresenceOperationSets"); } }
protected void setUp() throws Exception { super.setUp(); this._hashtable = createHashtable(TEST_SIZE); for (int i = 0; i < TEST_SIZE; ++i) { this._hashtable.add(String.valueOf(i)); } }
@Override protected void setUp() throws Exception { tmp = IO.getFile("generated/tmp"); tmp.mkdirs(); IO.copy(IO.getFile("testdata/ws"), tmp); workspace = Workspace.getWorkspace(tmp); workspace.refresh(); InfoRepository repo = workspace.getPlugin(InfoRepository.class); t1 = create("bsn-1", new Version(1, 0, 0)); t2 = create("bsn-2", new Version(1, 0, 0)); repo.put(new FileInputStream(t1), null); repo.put(new FileInputStream(t2), null); t1 = repo.get("bsn-1", new Version(1, 0, 0), null); t2 = repo.get("bsn-2", new Version(1, 0, 0), null); repo.put(new FileInputStream(IO.getFile("generated/biz.aQute.remote.launcher.jar")), null); workspace.getPlugins().add(repo); File storage = IO.getFile("generated/storage-1"); storage.mkdirs(); configuration = new HashMap<String, Object>(); configuration.put( Constants.FRAMEWORK_STORAGE_CLEAN, Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT); configuration.put(Constants.FRAMEWORK_STORAGE, storage.getAbsolutePath()); configuration.put( Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, "org.osgi.framework.launch;version=1.2"); framework = new org.apache.felix.framework.FrameworkFactory().newFramework(configuration); framework.init(); framework.start(); context = framework.getBundleContext(); location = "reference:" + IO.getFile("generated/biz.aQute.remote.agent.jar").toURI().toString(); agent = context.installBundle(location); agent.start(); thread = new Thread() { @Override public void run() { try { Main.main( new String[] { "-s", "generated/storage", "-c", "generated/cache", "-p", "1090", "-et" }); } catch (Exception e) { e.printStackTrace(); } } }; thread.setDaemon(true); thread.start(); super.setUp(); }
/** * Get a reference to the basic IM operation set. * * @throws Exception if this is not a good day. */ protected void setUp() throws Exception { super.setUp(); fixture.setUp(); Map<String, OperationSet> supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if (supportedOperationSets1 == null || supportedOperationSets1.size() < 1) throw new NullPointerException( "No OperationSet implementations are supported by " + "this implementation. "); // get the operation set presence here. opSetBasicIM1 = (OperationSetBasicInstantMessaging) supportedOperationSets1.get(OperationSetBasicInstantMessaging.class.getName()); if (opSetBasicIM1 == null) { throw new NullPointerException("No implementation for basic IM was found"); } // we also need the presence op set in order to retrieve contacts. opSetPresence1 = (OperationSetPresence) supportedOperationSets1.get(OperationSetPresence.class.getName()); // if the op set is null show that we're not happy. if (opSetPresence1 == null) { throw new NullPointerException( "An implementation of the service must provide an " + "implementation of at least one of the PresenceOperationSets"); } Map<String, OperationSet> supportedOperationSets2 = fixture.provider2.getSupportedOperationSets(); if (supportedOperationSets2 == null || supportedOperationSets2.size() < 1) throw new NullPointerException( "No OperationSet implementations are supported by " + "this implementation. "); // get the operation set presence here. opSetBasicIM2 = (OperationSetBasicInstantMessaging) supportedOperationSets2.get(OperationSetBasicInstantMessaging.class.getName()); if (opSetBasicIM2 == null) { throw new NullPointerException("No implementation for basic IM was found"); } opSetPresence2 = (OperationSetPresence) supportedOperationSets2.get(OperationSetPresence.class.getName()); // if the op set is null show that we're not happy. if (opSetPresence2 == null) { throw new NullPointerException( "An implementation of the service must provide an " + "implementation of at least one of the PresenceOperationSets"); } }
protected void setUp() throws Exception { super.setUp(); selenium = new DefaultSelenium( "localhost", SeleniumServer.DEFAULT_PORT, "*firefox", "http://localhost:" + SeleniumServer.DEFAULT_PORT); selenium.start(); }
protected void setUp() throws Exception { super.setUp(); /** @todo verify the constructors */ _hWPFDocFixture = new HWPFDocFixture(this); _hWPFDocFixture.setUp(); FileInformationBlock fib = _hWPFDocFixture._fib; byte[] mainStream = _hWPFDocFixture._mainStream; byte[] tableStream = _hWPFDocFixture._tableStream; _hWPFDocFixture.setUp(); _styleSheet = new StyleSheet(tableStream, fib.getFcStshf()); }
protected void setUp() throws Exception { // NOTE: This will disable the SYS GLOBAL party creation and creation of all the reference // entities!!! initializeModelData = false; super.setUp(); IDatabaseConnection dbUnitConn = null; dbUnitConn = getDbUnitConnection(); DatabaseOperation.REFRESH.execute(dbUnitConn, getDataSet()); dbUnitConn.getConnection().commit(); dbUnitConn.close(); dbUnitConn.getConnection().close(); }
@Override protected void setUp() throws Exception { super.setUp(); fixture.setUp(); Map<String, OperationSet> supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if (supportedOperationSets1 == null || supportedOperationSets1.size() < 1) throw new NullPointerException( "No OperationSet implementations are supported by " + "this Gibberish implementation. "); // get the operation set presence here. opSetPersPresence1 = (OperationSetPersistentPresence) supportedOperationSets1.get(OperationSetPersistentPresence.class.getName()); // if still null then the implementation doesn't offer a presence // operation set which is unacceptable for gibberish. if (opSetPersPresence1 == null) throw new NullPointerException( "An implementation of the gibberish service must provide an " + "implementation of at least the one of the Presence " + "Operation Sets"); // lets do it once again for the second provider Map<String, OperationSet> supportedOperationSets2 = fixture.provider2.getSupportedOperationSets(); if (supportedOperationSets2 == null || supportedOperationSets2.size() < 1) throw new NullPointerException( "No OperationSet implementations are supported by " + "this Gibberish implementation. "); // get the operation set presence here. opSetPersPresence2 = (OperationSetPersistentPresence) supportedOperationSets2.get(OperationSetPersistentPresence.class.getName()); // if still null then the implementation doesn't offer a presence // operation set which is unacceptable for Gibberish. if (opSetPersPresence2 == null) throw new NullPointerException( "An implementation of the Gibberish service must provide an " + "implementation of at least the one of the Presence " + "Operation Sets"); }
/** * Initialise members. * * @throws Exception if something goes wrong */ public void setUp() throws Exception { try { this.contentHandler = new RDFXMLContentHandler(); // let superclass set up too super.setUp(); } catch (Exception exception) { // try to tear down first try { tearDown(); } catch (Exception e2) { // ignore } throw exception; } }
protected void setUp() throws Exception { super.setUp(); fixture.setUp(); Map<String, OperationSet> supportedOperationSets = fixture.provider.getSupportedOperationSets(); if (supportedOperationSets == null || supportedOperationSets.size() < 1) throw new NullPointerException( "No OperationSet implementations are supported by " + "this ICQ implementation. "); // get the operation set presence here. operationSetPresence = (OperationSetPresence) supportedOperationSets.get(OperationSetPresence.class.getName()); // if the op set is null then the implementation doesn't offer a presence // operation set which is unacceptable for icq. if (operationSetPresence == null) { throw new NullPointerException( "An implementation of the ICQ service must provide an " + "implementation of at least the one of the Presence " + "Operation Sets"); } }
/** * Perform pre-test initialization. * * @throws Exception if the initialization fails for some reason * @see TestCase#setUp() * @generatedBy CodePro at 18/10/13 19:08 */ protected void setUp() throws Exception { super.setUp(); // add additional set up code here }
@Override protected void setUp() throws Exception { super.setUp(); }
@Override protected void setUp() throws Exception { super.setUp(); tree = new FakeTree(); }
protected void setUp() throws Exception { super.setUp(); // To change body of overridden methods use File | Settings | File Templates. page = new Page(new File("dummy")); }
/** * Initializes the fixture. * * @throws Exception if anything goes wrong. */ protected void setUp() throws Exception { super.setUp(); base64 = new Base64(); }
/** * JUnit setup method. * * @throws Exception in case anything goes wrong. */ protected void setUp() throws Exception { super.setUp(); fixture.setUp(); }
/* This class determines if more suites are added to this class then adds all individual test classes to a test suite for run */ public void run(String className) { try { mClassName = className; Class clazz = mContext.getClassLoader().loadClass(className); Method method = getChildrenMethod(clazz); if (method != null) { String[] children = getChildren(method); run(children); } else if (mRunnableClass.isAssignableFrom(clazz)) { Runnable test = (Runnable) clazz.newInstance(); TestCase testcase = null; if (test instanceof TestCase) { testcase = (TestCase) test; } Throwable e = null; boolean didSetup = false; started(className); try { if (testcase != null) { testcase.setUp(mContext); didSetup = true; } if (mMode == PERFORMANCE) { runInPerformanceMode(test, className, false, className); } else if (mMode == PROFILING) { // Need a way to mark a test to be run in profiling mode or not. startProfiling(); test.run(); finishProfiling(); } else { test.run(); } } catch (Throwable ex) { e = ex; } if (testcase != null && didSetup) { try { testcase.tearDown(); } catch (Throwable ex) { e = ex; } } finished(className); if (e == null) { passed(className); } else { failed(className, e); } } else if (mJUnitClass.isAssignableFrom(clazz)) { Throwable e = null; // Create a Junit Suite. JunitTestSuite suite = new JunitTestSuite(); Method[] methods = getAllTestMethods(clazz); for (Method m : methods) { junit.framework.TestCase test = (junit.framework.TestCase) clazz.newInstance(); test.setName(m.getName()); if (test instanceof AndroidTestCase) { AndroidTestCase testcase = (AndroidTestCase) test; try { testcase.setContext(mContext); testcase.setTestContext(mContext); } catch (Exception ex) { Log.i("TestHarness", ex.toString()); } } suite.addTest(test); } if (mMode == PERFORMANCE) { final int testCount = suite.testCount(); for (int j = 0; j < testCount; j++) { Test test = suite.testAt(j); started(test.toString()); try { runInPerformanceMode(test, className, true, test.toString()); } catch (Throwable ex) { e = ex; } finished(test.toString()); if (e == null) { passed(test.toString()); } else { failed(test.toString(), e); } } } else if (mMode == PROFILING) { // Need a way to mark a test to be run in profiling mode or not. startProfiling(); junit.textui.TestRunner.run(suite); finishProfiling(); } else { junit.textui.TestRunner.run(suite); } } else { System.out.println( "Test wasn't Runnable and didn't have a" + " children method: " + className); } } catch (ClassNotFoundException e) { Log.e("ClassNotFoundException for " + className, e.toString()); if (isJunitTest(className)) { runSingleJunitTest(className); } else { missingTest(className, e); } } catch (InstantiationException e) { System.out.println("InstantiationException for " + className); missingTest(className, e); } catch (IllegalAccessException e) { System.out.println("IllegalAccessException for " + className); missingTest(className, e); } }
/** The JUnit setup method */ protected void setUp() throws Exception { super.setUp(); builder = new InsertBuilder(); parserElements = new ArrayList<ParserElement>(); insertElements = new ArrayList<InsertElement>(); validElements = new ArrayList<InsertElement>(); try { InsertElement ele = new InsertElement(); String[] input = {"Table:TestTable~Field:FirstField~Value:1~Order:1"}; ele.process(input); parserElements.add(ele); insertElements.add(ele); validElements.add(ele); /* * - causing problems - how to remove value for duplicates in buildFieldList AND buildValueList * /add duplicate to one above * ele = new InsertElement(); * ele.process( input ); * parserElements.add( ele ); * insertElements.add( ele ); */ ele = new InsertElement(); input[0] = "Table:TestTable~Field:SecondField~Value:testing string~Type:String~Order:2"; ele.process(input); parserElements.add(ele); insertElements.add(ele); validElements.add(ele); ele = new InsertElement(); input[0] = "Table:TestTable~Field:ThirdField~Order:3"; ele.process(input); parserElements.add(ele); insertElements.add(ele); ele = new InsertElement(); input[0] = "Table:OtherTestTable~Field:ThirdField~Order:5"; ele.process(input); parserElements.add(ele); insertElements.add(ele); ele = new InsertElement(); input[0] = "Table:OtherTestTable~Field:NoField~Value:256.3652~Order:1"; ele.process(input); parserElements.add(ele); SelectElement sel = new SelectElement(); input[0] = "Table:ASQPARRGMT~Field:OAGATGDATETOD~Order:28"; sel.process(input); parserElements.add(sel); sel = new SelectElement(); input[0] = "Table:ETMSTZ~Field:TRACKPOSCORD~Order:42"; sel.process(input); parserElements.add(sel); FilterElement fil = new FilterElement(); input[0] = "Table:FLIGHT~Field:CARRIER~Operator:=~Value:none"; fil.process(input); parserElements.add(fil); /* add an InsertSequenceElement - this is a valid object */ InsertSequenceElement sele = new InsertSequenceElement(); input[0] = "Table:OtherTestTable~Field:sequence_field~Type:Numeric~Value:6~Order:6"; sele.process(input); parserElements.add(sele); insertElements.add(sele); validElements.add(sele); msg = new MsgObject(); msg.setWorkingObjects(parserElements); } catch (Exception e) { e.printStackTrace(); } }