Exemple #1
0
  @Test
  public void testStatVFS() throws Exception, VolumeNotFoundException {
    final String VOLUME_NAME_1 = "foobar";
    client.createVolume(mrcAddress, auth, userCredentials, VOLUME_NAME_1);

    Volume volume = client.openVolume(VOLUME_NAME_1, null, options);

    StatVFS volumeVFS = volume.statFS(userCredentials);

    MRCServiceClient mrcClient = new MRCServiceClient(testEnv.getRpcClient(), null);

    StatVFS mrcClientVFS = null;
    RPCResponse<StatVFS> resp = null;
    try {
      statvfsRequest input =
          statvfsRequest.newBuilder().setVolumeName(VOLUME_NAME_1).setKnownEtag(0).build();
      resp = mrcClient.statvfs(testEnv.getMRCAddress(), auth, userCredentials, input);
      mrcClientVFS = resp.get();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (resp != null) {
        resp.freeBuffers();
      }
    }
    assertNotNull(volumeVFS);
    assertEquals(mrcClientVFS, volumeVFS);
  }
Exemple #2
0
  @BeforeClass
  public static void initializeTest() throws Exception {
    FSUtils.delTree(new java.io.File(SetupUtils.TEST_DIR));

    Logging.start(SetupUtils.DEBUG_LEVEL, SetupUtils.DEBUG_CATEGORIES);

    dirConfig = SetupUtils.createDIRConfig();
    dir = new DIRRequestDispatcher(dirConfig, SetupUtils.createDIRdbsConfig());
    dir.startup();
    dir.waitForStartup();

    testEnv =
        new TestEnvironment(
            new TestEnvironment.Services[] {
              TestEnvironment.Services.DIR_CLIENT,
              TestEnvironment.Services.TIME_SYNC,
              TestEnvironment.Services.RPC_CLIENT,
              TestEnvironment.Services.MRC
            });
    testEnv.start();

    userCredentials = UserCredentials.newBuilder().setUsername("test").addGroups("test").build();

    dirAddress = testEnv.getDIRAddress().getHostName() + ":" + testEnv.getDIRAddress().getPort();
    mrcAddress = testEnv.getMRCAddress().getHostName() + ":" + testEnv.getMRCAddress().getPort();

    defaultCoordinates =
        VivaldiCoordinates.newBuilder()
            .setXCoordinate(0)
            .setYCoordinate(0)
            .setLocalError(0)
            .build();
    defaultStripingPolicy =
        StripingPolicy.newBuilder()
            .setType(StripingPolicyType.STRIPING_POLICY_RAID0)
            .setStripeSize(128)
            .setWidth(1)
            .build();

    osds = new OSD[4];
    configs = SetupUtils.createMultipleOSDConfigs(4);

    // start three OSDs
    osds[0] = new OSD(configs[0]);
    osds[1] = new OSD(configs[1]);
    osds[2] = new OSD(configs[2]);
    osds[3] = new OSD(configs[3]);

    mrcClient = new MRCServiceClient(testEnv.getRpcClient(), null);

    options = new Options();
    client = ClientFactory.createClient(dirAddress, userCredentials, null, options);
    client.start();
  }