@BeforeClass public static void setUp() throws Exception { KEY = MessageDigest.getInstance("SHA-256").digest(ALIAS.getBytes()); // Create a JKECS store containing a test secret key KeyStore store = KeyStore.getInstance("JCEKS"); store.load(null, PASSWORD.toCharArray()); store.setEntry( ALIAS, new KeyStore.SecretKeyEntry(new SecretKeySpec(KEY, "AES")), new KeyStore.PasswordProtection(PASSWORD.toCharArray())); // Create the test directory String dataDir = TEST_UTIL.getDataTestDir().toString(); new File(dataDir).mkdirs(); // Write the keystore file storeFile = new File(dataDir, "keystore.jks"); FileOutputStream os = new FileOutputStream(storeFile); try { store.store(os, PASSWORD.toCharArray()); } finally { os.close(); } // Write the password file Properties p = new Properties(); p.setProperty(ALIAS, PASSWORD); passwordFile = new File(dataDir, "keystore.pw"); os = new FileOutputStream(passwordFile); try { p.store(os, ""); } finally { os.close(); } }
private void setupProcedureStore() throws IOException { Path testDir = UTIL.getDataTestDir(); FileSystem fs = testDir.getFileSystem(conf); Path logDir = new Path(testDir, "proc-logs"); System.out.println("Logs directory : " + logDir.toString()); fs.delete(logDir, true); if ("nosync".equals(syncType)) { store = new NoSyncWalProcedureStore(conf, fs, logDir); } else { store = ProcedureTestingUtility.createWalStore(conf, fs, logDir); } store.start(numThreads); store.recoverLease(); store.load(new ProcedureTestingUtility.LoadCounter()); System.out.println( "Starting new log : " + store.getActiveLogs().get(store.getActiveLogs().size() - 1)); }
@Before public void setUp() throws IOException { htu = new HBaseCommonTestingUtility(); setupConfiguration(htu.getConfiguration()); testDir = htu.getDataTestDir(); fs = testDir.getFileSystem(htu.getConfiguration()); assertTrue(testDir.depth() > 1); logDir = new Path(testDir, "proc-logs"); procStore = ProcedureTestingUtility.createWalStore(htu.getConfiguration(), fs, logDir); procStore.start(PROCEDURE_STORE_SLOTS); procStore.recoverLease(); LoadCounter loader = new LoadCounter(); procStore.load(loader); assertEquals(0, loader.getMaxProcId()); assertEquals(0, loader.getLoadedCount()); assertEquals(0, loader.getCorruptedCount()); }