@BeforeClass(alwaysRun = true) static public void setUpDataSource() throws Exception { File propertiesFile = new File("config/application.properties"); if (!propertiesFile.exists()) { throw new IllegalStateException( "Missing configuration file, please create config/application.properties based on sample."); } Properties props = new Properties(); try (FileInputStream fis = new FileInputStream(propertiesFile)) { props.load(fis); } PGPoolingDataSource dataSource = new PGPoolingDataSource(); dataSource.setServerName(props.getProperty("db.server")); dataSource.setDatabaseName(props.getProperty("db.database")); dataSource.setUser(props.getProperty("db.user")); dataSource.setPassword(props.getProperty("db.password")); dataSource.setPortNumber(Integer.parseInt(props.getProperty("db.port"))); BaseITest.dataSource = dataSource; }
@BeforeClass public void setup() throws Exception { vhFinalField = MethodHandles.lookup().findVarHandle( VarHandleTestMethodHandleAccessLong.class, "final_v", long.class); vhField = MethodHandles.lookup().findVarHandle( VarHandleTestMethodHandleAccessLong.class, "v", long.class); vhStaticFinalField = MethodHandles.lookup().findStaticVarHandle( VarHandleTestMethodHandleAccessLong.class, "static_final_v", long.class); vhStaticField = MethodHandles.lookup().findStaticVarHandle( VarHandleTestMethodHandleAccessLong.class, "static_v", long.class); vhArray = MethodHandles.arrayElementVarHandle(long[].class); }
@BeforeClass public static void setUpEditorPadTest() { if (!GraphicsEnvironment.isHeadless()) { try { robot = new Robot(); robot.setAutoWaitForIdle(true); robot.setAutoDelay(DELAY); } catch (AWTException e) { throw new ExceptionInInitializerError(e); } } }
@BeforeClass public void setup() throws IOException{ out = new ByteArrayOutputStream(); Configuration config = new Configuration(); try(MDSRecordWriter writer = new MDSRecordWriter(out , config )) { JacksonMessageReader messageReader = new JacksonMessageReader(); BufferedReader in = new BufferedReader(new InputStreamReader(this.getClass().getClassLoader().getResource("blackbox/TestMultiArray.json").openStream())); String line = in.readLine(); while (line != null) { IParser parser = messageReader.create(line); writer.addParserRow(parser); line = in.readLine(); } } }
@BeforeClass public void initialize() throws Exception { CreateMultiReleaseTestJars creator = new CreateMultiReleaseTestJars(); creator.compileEntries(); creator.buildMultiReleaseJar(); int RUNTIME_VERSION = Runtime.version().major(); rtVersion = Integer.getInteger("jdk.util.jar.version", RUNTIME_VERSION); String mrprop = System.getProperty("jdk.util.jar.enableMultiRelease", ""); if (mrprop.equals("false")) { rtVersion = BASE_VERSION; } else if (rtVersion < BASE_VERSION) { rtVersion = BASE_VERSION; } else if (rtVersion > RUNTIME_VERSION) { rtVersion = RUNTIME_VERSION; } force = mrprop.equals("force"); initializeClassLoader(); }
@BeforeClass public void setup() throws Exception { vhFinalField = MethodHandles.lookup().findVarHandle( VarHandleTestAccessDouble.class, "final_v", double.class); vhField = MethodHandles.lookup().findVarHandle( VarHandleTestAccessDouble.class, "v", double.class); vhStaticFinalField = MethodHandles.lookup().findStaticVarHandle( VarHandleTestAccessDouble.class, "static_final_v", double.class); vhStaticField = MethodHandles.lookup().findStaticVarHandle( VarHandleTestAccessDouble.class, "static_v", double.class); vhArray = MethodHandles.arrayElementVarHandle(double[].class); }
@BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) public void beforeClass() { // set up the client client = new AsyncDocumentClient.Builder() .withServiceEndpoint(TestConfigurations.HOST) .withMasterKey(TestConfigurations.MASTER_KEY) .withConnectionPolicy(ConnectionPolicy.GetDefault()) .withConsistencyLevel(ConsistencyLevel.Session) .build(); registerSpyProxy(); Database databaseDefinition = new Database(); databaseDefinition.setId(DATABASE_ID); try { client.deleteDatabase(Utils.getDatabaseLink(databaseDefinition, true), null).toBlocking().single(); } catch (Exception e) { // ignore failure if it doesn't exist } database = client.createDatabase(databaseDefinition, null).toBlocking().single().getResource(); collection = client.createCollection(database.getSelfLink(), getCollectionDefinition(), null).toBlocking().single().getResource(); }
@BeforeClass protected void setUp() throws Exception { // A SessionFactory is set up once for an application! final StandardServiceRegistry registry = new StandardServiceRegistryBuilder() .configure() // configures settings from hibernate.cfg.xml .build(); try { sessionFactory = new MetadataSources(registry).buildMetadata().buildSessionFactory(); } catch (Exception e) { e.printStackTrace(); // The registry would be destroyed by the SessionFactory, but we had trouble building the SessionFactory // so destroy it manually. StandardServiceRegistryBuilder.destroy( registry ); } }
@BeforeClass public void setup() throws Exception { vhFinalField = MethodHandles.lookup().findVarHandle( VarHandleTestMethodTypeByte.class, "final_v", byte.class); vhField = MethodHandles.lookup().findVarHandle( VarHandleTestMethodTypeByte.class, "v", byte.class); vhStaticFinalField = MethodHandles.lookup().findStaticVarHandle( VarHandleTestMethodTypeByte.class, "static_final_v", byte.class); vhStaticField = MethodHandles.lookup().findStaticVarHandle( VarHandleTestMethodTypeByte.class, "static_v", byte.class); vhArray = MethodHandles.arrayElementVarHandle(byte[].class); }
@BeforeClass public void setup() throws Exception { vhFinalField = MethodHandles.lookup().findVarHandle( VarHandleTestMethodTypeFloat.class, "final_v", float.class); vhField = MethodHandles.lookup().findVarHandle( VarHandleTestMethodTypeFloat.class, "v", float.class); vhStaticFinalField = MethodHandles.lookup().findStaticVarHandle( VarHandleTestMethodTypeFloat.class, "static_final_v", float.class); vhStaticField = MethodHandles.lookup().findStaticVarHandle( VarHandleTestMethodTypeFloat.class, "static_v", float.class); vhArray = MethodHandles.arrayElementVarHandle(float[].class); }
@BeforeClass public void setup() throws Exception { vhFinalField = MethodHandles.lookup().findVarHandle( VarHandleTestMethodTypeDouble.class, "final_v", double.class); vhField = MethodHandles.lookup().findVarHandle( VarHandleTestMethodTypeDouble.class, "v", double.class); vhStaticFinalField = MethodHandles.lookup().findStaticVarHandle( VarHandleTestMethodTypeDouble.class, "static_final_v", double.class); vhStaticField = MethodHandles.lookup().findStaticVarHandle( VarHandleTestMethodTypeDouble.class, "static_v", double.class); vhArray = MethodHandles.arrayElementVarHandle(double[].class); }
@BeforeClass(enabled = false) public void registerUser() throws CipherException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException, IOException { ssp = createNewMember(2, 100) .thenApply(papyrusMember -> { allTransactionsMinedAsync(asList(papyrusMember.refillTransaction, papyrusMember.mintTransaction)); return papyrusMember; }).join(); sspRegistrar = createNewMember(2, 100) .thenApply(papyrusMember -> { allTransactionsMinedAsync(asList(papyrusMember.refillTransaction, papyrusMember.mintTransaction)); return papyrusMember; }).join(); dao = loadDaoContract(ssp.transactionManager); daoRegistrar = loadDaoContract(sspRegistrar.transactionManager); token = asCf(dao.token()).thenApply(tokenAddress -> loadTokenContract(tokenAddress.toString(), ssp.transactionManager)).join(); tokenRegistrar = asCf(daoRegistrar.token()) .thenApply(tokenAddress -> loadTokenContract(tokenAddress.toString(), sspRegistrar.transactionManager) ).join(); sspRegistry = asCf(daoRegistrar.sspRegistry()) .thenApply(sspRegistryAddress -> loadSspRegistry(sspRegistryAddress.toString(), ssp.transactionManager)) .join(); initDepositContract(); }
@BeforeClass public void setup() throws Exception { vhFinalField = MethodHandles.lookup().findVarHandle( VarHandleTestMethodHandleAccessBoolean.class, "final_v", boolean.class); vhField = MethodHandles.lookup().findVarHandle( VarHandleTestMethodHandleAccessBoolean.class, "v", boolean.class); vhStaticFinalField = MethodHandles.lookup().findStaticVarHandle( VarHandleTestMethodHandleAccessBoolean.class, "static_final_v", boolean.class); vhStaticField = MethodHandles.lookup().findStaticVarHandle( VarHandleTestMethodHandleAccessBoolean.class, "static_v", boolean.class); vhArray = MethodHandles.arrayElementVarHandle(boolean[].class); }
@BeforeClass public void setup() throws SAXException, IOException, ParserConfigurationException { sf = newSchemaFactory(); assertNotNull(sf); ifac = XMLInputFactory.newInstance(); xsd1 = Files.readAllBytes(Paths.get(XML_DIR + "test.xsd")); xsd2 = Files.readAllBytes(Paths.get(XML_DIR + "test1.xsd")); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); xsdDoc1 = db.parse(newInputStream(xsd1)); xsdDoc2 = db.parse(newInputStream(xsd2)); xml = Files.readAllBytes(Paths.get(XML_DIR + "test.xml")); }
@BeforeClass protected void startftp() throws Exception { fakeFtpServer = new FakeFtpServer(); fakeFtpServer.setServerControlPort(8089); // use any free port FileSystem fileSystem = new UnixFakeFileSystem(); fileSystem.add(new FileEntry("/data/s1-level-1-calibration.xsd", "<schema/>")); fileSystem.add(new FileEntry("/data/s1-object-types.xsd", "<schema/>")); fileSystem.add(new FileEntry("/data/GOM_EXT_2PNPDE20070312_232536_000000542056_00202_26308_1271.N1", "GOMOS DATA!")); fileSystem.add(new FileEntry ("/data/S1A_IW_SLC__1SDV_20141003T054235_20141003T054304_002661_002F66_D5C8.SAFE/manifest.safe", "<XFDU/>")); fileSystem.add(new FileEntry ("/data/S1A_EW_GRDH_1SSH_20120101T022934_20120101T022945_001770_000001_AF02.SAFE/manifest.safe", "<XFDU/>")); fileSystem.add(new FileEntry("/data/manifest.safe", "<XFDU/>")); fakeFtpServer.setFileSystem(fileSystem); UserAccount userAccount = new UserAccount("user", "password", "/"); fakeFtpServer.addUserAccount(userAccount); fakeFtpServer.start(); }
@BeforeClass public void setup() throws Throwable { if (Files.notExists(JMODS)) { return; } Files.createDirectories(MODS); for (String mn : MODULES) { Path mod = MODS.resolve(mn); if (!CompilerUtils.compile(SRC.resolve(mn), mod)) { throw new AssertionError("Compilation failure. See log."); } } }
@BeforeClass public void setup() { this.policyMatcher = new PolicyMatcherImpl(); MockitoAnnotations.initMocks(this); when(this.attributeReaderFactory.getResourceAttributeReader()).thenReturn(this.defaultResourceAttributeReader); when(this.attributeReaderFactory.getSubjectAttributeReader()).thenReturn(this.defaultSubjectAttributeReader); when(this.defaultResourceAttributeReader.getAttributes(anyString())).thenReturn(Collections.emptySet()); BaseSubject subject = new BaseSubject("test-subject"); subject.setAttributes(new HashSet<>()); when(this.defaultSubjectAttributeReader.getAttributesByScope(anyString(), anySetOf(Attribute.class))) .thenReturn(subject.getAttributes()); }
@BeforeClass public void initializeTestData() { testData.put(AssetTemplateCategory.MOBILE, "1"); testData.put(AssetTemplateCategory.WEB, "2"); testData.put(AssetTemplateCategory.PRINT, "3"); testData.put(AssetTemplateCategory.PHOTO, "4"); testData.put(AssetTemplateCategory.FILM, "5"); testData.put(AssetTemplateCategory.ART, "6"); }
@BeforeClass public void initializeTestData() { testData.put(LicenseHistoryThumbnailSize.MEDIUM, "110"); testData.put(LicenseHistoryThumbnailSize.BIG, "160"); testData.put(LicenseHistoryThumbnailSize.LARGE, "220"); testData.put(LicenseHistoryThumbnailSize.VERY_LARGE, "240"); testData.put(LicenseHistoryThumbnailSize.XL, "500"); testData.put(LicenseHistoryThumbnailSize.XXL, "1000"); }
@BeforeClass(alwaysRun=true) public static void generateToken() throws Exception { HashMap<String, Long> timeClaims = new HashMap<>(); token = TokenUtils.generateTokenString("/Token1.json", null, timeClaims); iatClaim = timeClaims.get(Claims.iat.name()); authTimeClaim = timeClaims.get(Claims.auth_time.name()); expClaim = timeClaims.get(Claims.exp.name()); }
@BeforeClass public void initializeTestData() { testData.put(AssetOrientation.HORIZONTAL, "horizontal"); testData.put(AssetOrientation.VERTICAL, "vertical"); testData.put(AssetOrientation.SQUARE, "square"); testData.put(AssetOrientation.ALL, "all"); }
@BeforeClass public static void setUpClass() throws Exception { int maxLen = 128; StringBuilder s = new StringBuilder(maxLen); for (int i = 0; i < maxLen; i++) { s.append('a'); } maxIdentifier = s.toString(); }
@BeforeClass public void setUp() throws JMSException{ context = new ClassPathXmlApplicationContext("**/test-app-context.xml"); //load instance of listener, with dependencies injected listener = (CmsListener) context .getBean("cmsListener"); WorkflowController wfController = mock(WorkflowController.class); listener.setWfController(wfController); listener.init(); listener.getConnectionStats(); //exercise the Util class here }
@BeforeClass public void initializeTestData() { testData.put(AssetType.PHOTOS, "1"); testData.put(AssetType.ILLUSTRATIONS, "2"); testData.put(AssetType.VECTORS, "3"); testData.put(AssetType.VIDEOS, "4"); testData.put(AssetType.INSTANT_PHOTOS, "5"); testData.put(AssetType.THREE_DIMENSIONAL, "6"); testData.put(AssetType.TEMPLATES, "7"); }
@BeforeClass public void setup() throws Exception { data = new FiltersAndGolden[4]; data[0] = new FiltersAndGolden(getGoldenFileName(1), astro -> astro.getRAFilter(0.106, 0.108)); data[1] = new FiltersAndGolden(getGoldenFileName(2), astro -> astro.getStellarTypeFilter("K0IIIbCN-0.5")); data[2] = new FiltersAndGolden(getGoldenFileName(3), astro -> astro.getStellarTypeFilter("G"), astro -> astro.getDecFilter(-5.0, 60.0)); data[3] = new FiltersAndGolden(getGoldenFileName(4), astro -> astro.getRADECFilter(0.084, 0.096, -5.75, 14.0)); }
@BeforeClass public void setup() throws SAXException, IOException, ParserConfigurationException { schema = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI).newSchema(new File(XML_DIR + "test.xsd")); assertNotNull(schema); xmlFileUri = filenameToURL(XML_DIR + "test.xml"); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); xmlDoc = dbf.newDocumentBuilder().parse(xmlFileUri); }
@BeforeClass public void initClass() { fieldMap = new HashMap<>(); fieldMap.put(ChronoField.ERA, "era"); fieldMap.put(ChronoField.YEAR, "year"); fieldMap.put(ChronoField.MONTH_OF_YEAR, "month"); fieldMap.put(ChronoField.DAY_OF_MONTH, "day"); fieldMap.put(ChronoField.AMPM_OF_DAY, "dayperiod"); fieldMap.put(ChronoField.ALIGNED_WEEK_OF_YEAR, "week"); fieldMap.put(ChronoField.DAY_OF_WEEK, "weekday"); fieldMap.put(ChronoField.HOUR_OF_DAY, "hour"); fieldMap.put(ChronoField.MINUTE_OF_HOUR, "minute"); fieldMap.put(ChronoField.SECOND_OF_MINUTE, "second"); fieldMap.put(ChronoField.OFFSET_SECONDS, "zone"); }
@BeforeClass public void setupTest() { engine = new ScriptEngineManager().getEngineByName("js"); engine.put("f", new AbstractJSObject() { @Override public boolean isFunction() { return true; } @Override public Object call(final Object thiz, final Object... args) { return Arrays.deepToString(args); } }); }
@Parameters({"broker-hostname", "broker-rest-port"}) @BeforeClass public void setUp(String brokerHost, String port) throws Exception { apiBasePath = ClientHelper.getRestApiBasePath(brokerHost, port); objectMapper = new ObjectMapper(); responseHandler = new BasicResponseHandler(); }
@BeforeClass void init() throws IOException { InputStream is=ProcessingManager.class.getResourceAsStream("size-test.zip"); File tmp_folder = Files.createTempDir(); File output = new File (tmp_folder, "size-test.zip"); FileUtils.copyInputStreamToFile(is, output); is.close(); sample = output; }
@BeforeClass /** set up using DI from Spring*/ public void setUp(){ context = new ClassPathXmlApplicationContext("**/test-app-context.xml"); //load instance of publisher, with dependencies injected publisher = (InductorPublisher) context.getBean("inductorPublisher"); }
@BeforeClass public static void setUpClass() throws ScriptException { final ScriptEngineManager m = new ScriptEngineManager(); e = m.getEngineByName("nashorn"); o = new SharedObject(); e.put("o", o); e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.test.SharedObject;"); }
@BeforeClass public void setup() throws Exception { ifac = XMLInputFactory.newInstance(); ofac = XMLOutputFactory.newInstance(); tfac = TransformerFactory.newInstance(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); db = dbf.newDocumentBuilder(); xml = Files.readAllBytes(Paths.get(XML_DIR + "cities.xml")); template = Files.readAllBytes(Paths.get(XML_DIR + "cities.xsl")); xmlDoc = db.parse(xmlInputStream()); }
@BeforeClass static void init() throws Exception { UNSAFE = getUnsafe(); byte[] srcData = new byte[20]; for (int i=0; i<20; i++) srcData[i] = (byte)i; Files.write(bob, srcData); }
@BeforeClass public void authenticate() { int sb = new Random().nextBoolean() ? 1 : 0; String name = users.get(sb); SandBoxUser user = new SandBoxUser(name, name, true, sb, roles); UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(user, user.getPassword()); SecurityContextHolder.getContext().setAuthentication(token); }
@BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) public void beforeClass() throws Exception { // set up the client client = clientBuilder.build(); Database d = new Database(); d.setId(DATABASE_ID); createdDatabase = safeCreateDatabase(client, d); createdCollection = safeCreateCollection(client, createdDatabase.getSelfLink(), getCollectionDefinition()); for(int i = 0; i < 5; i++) { createDocument(client, i); } }
/** * Setup method.. Create the region and put data in the region. * * @throws Exception */ @BeforeClass private void setUpMethod() throws Exception { // System.out.println("MonarchGetWithFilterFunctionTest.setUpMethod"); Map<String, String> confMap = new HashMap<String, String>(1) {{ put(MonarchUtils.LOCATOR_PORT, testBase.getLocatorPort());}}; MonarchUtils.createConnectionAndTable(regionName, confMap, false, null, columnMap); putDataInTable(regionName); }
@BeforeClass public void setupData() { try { hubProjectParametersJsonAllPresent = JsonUtil.getObjectMapper().writeValueAsString(new HubProjectParameters(TEST_PROJECTNAME, TEST_CODELOCATION)); hubProjectParametersJsonNoProject = JsonUtil.getObjectMapper().writeValueAsString(new HubProjectParameters(null, TEST_CODELOCATION)); hubProjectParametersJsonNoCodeLoc = JsonUtil.getObjectMapper().writeValueAsString(new HubProjectParameters(TEST_PROJECTNAME, null)); } catch (JsonProcessingException e) { throw new RuntimeException(e); } }
@BeforeClass public void setup() throws Exception { File file = new File(getClass().getClassLoader().getResource("swaggerDeleteResponse.json").toURI()); File deployedFile = new File(getClass().getClassLoader().getResource("swagger.json").toURI()); swagger = new SwaggerParser().read(file.getAbsolutePath()); swaggerDeployed = new SwaggerParser().read(deployedFile.getAbsolutePath()); }