コード例 #1
0
  @BeforeMethod
  public void setUp() throws Exception {
    // do cleanup of other tests that may have started writers.
    // this is necessary in a non-forked test suite environment
    // where partition ids could collide
    Utils.finishBackupWriters();

    m_tmpDir = new File(System.getProperty("java.io.tmpdir"), "PartitionStoreStageTest");
    if (!m_tmpDir.exists()) {
      assertTrue("Failed to make the directories.", m_tmpDir.mkdirs());
    }

    // Add a dummy partition
    String server = "test";
    String storage = m_tmpDir + "/storage";

    File storageDir = new File(storage);
    if (!storageDir.exists()) {
      assertTrue("Failed to make the storage directory.", storageDir.mkdirs());
      if (!storageDir.exists()) {
        s_logger.warn("Storage Directory " + storage + " does not exist.");
      }
    }

    String mapped = m_tmpDir + "/mapped";

    File mappedDir = new File(mapped);
    if (!mappedDir.exists()) {
      assertTrue("Failed to make the mapped directories.", mappedDir.mkdirs());
      if (!mappedDir.exists()) {
        s_logger.warn("Storage Directory " + mapped + " does not exist.");
      }
    }

    if (m_part == null) {
      IPartitionManager pm = ManagementContainer.getInstance().getPartitionManager();
      m_part = pm.initializePartition(TEST_PID, server, storage, mapped);
    }
    Utils.startBackupWriters();
  }
コード例 #2
0
 public void setupPartition(int partitionId, int storageId) {
   IPartitionManager pMgr = ManagementContainer.getInstance().getPartitionManager();
   m_partitions.add(
       pMgr.initializePartition(partitionId, "localhost", "storage" + storageId, null));
 }