Repository: hadoop
Updated Branches:
  refs/heads/branch-3.0 a97fe585b -> 62a819d5e


http://git-wip-us.apache.org/repos/asf/hadoop/blob/62a819d5/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/federation/store/records/TestMembershipState.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/federation/store/records/TestMembershipState.java
 
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/federation/store/records/TestMembershipState.java
deleted file mode 100644
index d922414..0000000
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/federation/store/records/TestMembershipState.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hdfs.server.federation.store.records;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-
-import 
org.apache.hadoop.hdfs.server.federation.resolver.FederationNamenodeServiceState;
-import 
org.apache.hadoop.hdfs.server.federation.store.driver.StateStoreSerializer;
-import org.junit.Test;
-
-/**
- * Test the Membership State records.
- */
-public class TestMembershipState {
-
-  private static final String ROUTER = "router";
-  private static final String NAMESERVICE = "nameservice";
-  private static final String NAMENODE = "namenode";
-  private static final String CLUSTER_ID = "cluster";
-  private static final String BLOCKPOOL_ID = "blockpool";
-  private static final String RPC_ADDRESS = "rpcaddress";
-  private static final String SERVICE_ADDRESS = "serviceaddress";
-  private static final String LIFELINE_ADDRESS = "lifelineaddress";
-  private static final String WEB_ADDRESS = "webaddress";
-  private static final boolean SAFE_MODE = false;
-
-  private static final long DATE_CREATED = 100;
-  private static final long DATE_MODIFIED = 200;
-
-  private static final long NUM_BLOCKS = 300;
-  private static final long NUM_FILES = 400;
-  private static final int NUM_DEAD = 500;
-  private static final int NUM_ACTIVE = 600;
-  private static final int NUM_DECOM = 700;
-  private static final int NUM_DECOM_ACTIVE = 800;
-  private static final int NUM_DECOM_DEAD = 900;
-  private static final long NUM_BLOCK_MISSING = 1000;
-
-  private static final long TOTAL_SPACE = 1100;
-  private static final long AVAILABLE_SPACE = 1200;
-
-  private static final FederationNamenodeServiceState STATE =
-      FederationNamenodeServiceState.ACTIVE;
-
-  private MembershipState createRecord() throws IOException {
-
-    MembershipState record = MembershipState.newInstance(
-        ROUTER, NAMESERVICE, NAMENODE, CLUSTER_ID,
-        BLOCKPOOL_ID, RPC_ADDRESS, SERVICE_ADDRESS, LIFELINE_ADDRESS,
-        WEB_ADDRESS, STATE, SAFE_MODE);
-    record.setDateCreated(DATE_CREATED);
-    record.setDateModified(DATE_MODIFIED);
-
-    MembershipStats stats = MembershipStats.newInstance();
-    stats.setNumOfBlocks(NUM_BLOCKS);
-    stats.setNumOfFiles(NUM_FILES);
-    stats.setNumOfActiveDatanodes(NUM_ACTIVE);
-    stats.setNumOfDeadDatanodes(NUM_DEAD);
-    stats.setNumOfDecommissioningDatanodes(NUM_DECOM);
-    stats.setNumOfDecomActiveDatanodes(NUM_DECOM_ACTIVE);
-    stats.setNumOfDecomDeadDatanodes(NUM_DECOM_DEAD);
-    stats.setNumOfBlocksMissing(NUM_BLOCK_MISSING);
-    stats.setTotalSpace(TOTAL_SPACE);
-    stats.setAvailableSpace(AVAILABLE_SPACE);
-    record.setStats(stats);
-    return record;
-  }
-
-  private void validateRecord(MembershipState record) throws IOException {
-
-    assertEquals(ROUTER, record.getRouterId());
-    assertEquals(NAMESERVICE, record.getNameserviceId());
-    assertEquals(CLUSTER_ID, record.getClusterId());
-    assertEquals(BLOCKPOOL_ID, record.getBlockPoolId());
-    assertEquals(RPC_ADDRESS, record.getRpcAddress());
-    assertEquals(WEB_ADDRESS, record.getWebAddress());
-    assertEquals(STATE, record.getState());
-    assertEquals(SAFE_MODE, record.getIsSafeMode());
-    assertEquals(DATE_CREATED, record.getDateCreated());
-    assertEquals(DATE_MODIFIED, record.getDateModified());
-
-    MembershipStats stats = record.getStats();
-    assertEquals(NUM_BLOCKS, stats.getNumOfBlocks());
-    assertEquals(NUM_FILES, stats.getNumOfFiles());
-    assertEquals(NUM_ACTIVE, stats.getNumOfActiveDatanodes());
-    assertEquals(NUM_DEAD, stats.getNumOfDeadDatanodes());
-    assertEquals(NUM_DECOM, stats.getNumOfDecommissioningDatanodes());
-    assertEquals(NUM_DECOM_ACTIVE, stats.getNumOfDecomActiveDatanodes());
-    assertEquals(NUM_DECOM_DEAD, stats.getNumOfDecomDeadDatanodes());
-    assertEquals(TOTAL_SPACE, stats.getTotalSpace());
-    assertEquals(AVAILABLE_SPACE, stats.getAvailableSpace());
-  }
-
-  @Test
-  public void testGetterSetter() throws IOException {
-    MembershipState record = createRecord();
-    validateRecord(record);
-  }
-
-  @Test
-  public void testSerialization() throws IOException {
-
-    MembershipState record = createRecord();
-
-    StateStoreSerializer serializer = StateStoreSerializer.getSerializer();
-    String serializedString = serializer.serializeString(record);
-    MembershipState newRecord =
-        serializer.deserialize(serializedString, MembershipState.class);
-
-    validateRecord(newRecord);
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hadoop/blob/62a819d5/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/federation/store/records/TestMountTable.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/federation/store/records/TestMountTable.java
 
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/federation/store/records/TestMountTable.java
deleted file mode 100644
index 4282718..0000000
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/federation/store/records/TestMountTable.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hdfs.server.federation.store.records;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.hadoop.hdfs.server.federation.resolver.RemoteLocation;
-import 
org.apache.hadoop.hdfs.server.federation.resolver.order.DestinationOrder;
-import 
org.apache.hadoop.hdfs.server.federation.store.driver.StateStoreSerializer;
-import org.apache.hadoop.test.GenericTestUtils;
-import org.junit.Test;
-
-/**
- * Test the Mount Table entry in the State Store.
- */
-public class TestMountTable {
-
-  private static final String SRC = "/test";
-  private static final String DST_NS_0 = "ns0";
-  private static final String DST_NS_1 = "ns1";
-  private static final String DST_PATH_0 = "/path1";
-  private static final String DST_PATH_1 = "/path/path2";
-  private static final List<RemoteLocation> DST = new LinkedList<>();
-  static {
-    DST.add(new RemoteLocation(DST_NS_0, DST_PATH_0));
-    DST.add(new RemoteLocation(DST_NS_1, DST_PATH_1));
-  }
-  private static final Map<String, String> DST_MAP = new LinkedHashMap<>();
-  static {
-    DST_MAP.put(DST_NS_0, DST_PATH_0);
-    DST_MAP.put(DST_NS_1, DST_PATH_1);
-  }
-
-  private static final long DATE_CREATED = 100;
-  private static final long DATE_MOD = 200;
-
-
-  @Test
-  public void testGetterSetter() throws IOException {
-
-    MountTable record = MountTable.newInstance(SRC, DST_MAP);
-
-    validateDestinations(record);
-    assertEquals(SRC, record.getSourcePath());
-    assertEquals(DST, record.getDestinations());
-    assertTrue(DATE_CREATED > 0);
-    assertTrue(DATE_MOD > 0);
-
-    MountTable record2 =
-        MountTable.newInstance(SRC, DST_MAP, DATE_CREATED, DATE_MOD);
-
-    validateDestinations(record2);
-    assertEquals(SRC, record2.getSourcePath());
-    assertEquals(DST, record2.getDestinations());
-    assertEquals(DATE_CREATED, record2.getDateCreated());
-    assertEquals(DATE_MOD, record2.getDateModified());
-    assertFalse(record.isReadOnly());
-    assertEquals(DestinationOrder.HASH, record.getDestOrder());
-  }
-
-  @Test
-  public void testSerialization() throws IOException {
-    testSerialization(DestinationOrder.RANDOM);
-    testSerialization(DestinationOrder.HASH);
-    testSerialization(DestinationOrder.LOCAL);
-  }
-
-  private void testSerialization(final DestinationOrder order)
-      throws IOException {
-
-    MountTable record = MountTable.newInstance(
-        SRC, DST_MAP, DATE_CREATED, DATE_MOD);
-    record.setReadOnly(true);
-    record.setDestOrder(order);
-
-    StateStoreSerializer serializer = StateStoreSerializer.getSerializer();
-    String serializedString = serializer.serializeString(record);
-    MountTable record2 =
-        serializer.deserialize(serializedString, MountTable.class);
-
-    validateDestinations(record2);
-    assertEquals(SRC, record2.getSourcePath());
-    assertEquals(DST, record2.getDestinations());
-    assertEquals(DATE_CREATED, record2.getDateCreated());
-    assertEquals(DATE_MOD, record2.getDateModified());
-    assertTrue(record2.isReadOnly());
-    assertEquals(order, record2.getDestOrder());
-  }
-
-  @Test
-  public void testReadOnly() throws IOException {
-
-    Map<String, String> dest = new LinkedHashMap<>();
-    dest.put(DST_NS_0, DST_PATH_0);
-    dest.put(DST_NS_1, DST_PATH_1);
-    MountTable record1 = MountTable.newInstance(SRC, dest);
-    record1.setReadOnly(true);
-
-    validateDestinations(record1);
-    assertEquals(SRC, record1.getSourcePath());
-    assertEquals(DST, record1.getDestinations());
-    assertTrue(DATE_CREATED > 0);
-    assertTrue(DATE_MOD > 0);
-    assertTrue(record1.isReadOnly());
-
-    MountTable record2 = MountTable.newInstance(
-        SRC, DST_MAP, DATE_CREATED, DATE_MOD);
-    record2.setReadOnly(true);
-
-    validateDestinations(record2);
-    assertEquals(SRC, record2.getSourcePath());
-    assertEquals(DST, record2.getDestinations());
-    assertEquals(DATE_CREATED, record2.getDateCreated());
-    assertEquals(DATE_MOD, record2.getDateModified());
-    assertTrue(record2.isReadOnly());
-  }
-
-  @Test
-  public void testOrder() throws IOException {
-    testOrder(DestinationOrder.HASH);
-    testOrder(DestinationOrder.LOCAL);
-    testOrder(DestinationOrder.RANDOM);
-  }
-
-  private void testOrder(final DestinationOrder order)
-      throws IOException {
-
-    MountTable record = MountTable.newInstance(
-        SRC, DST_MAP, DATE_CREATED, DATE_MOD);
-    record.setDestOrder(order);
-
-    validateDestinations(record);
-    assertEquals(SRC, record.getSourcePath());
-    assertEquals(DST, record.getDestinations());
-    assertEquals(DATE_CREATED, record.getDateCreated());
-    assertEquals(DATE_MOD, record.getDateModified());
-    assertEquals(order, record.getDestOrder());
-  }
-
-  private void validateDestinations(MountTable record) {
-
-    assertEquals(SRC, record.getSourcePath());
-    assertEquals(2, record.getDestinations().size());
-
-    RemoteLocation location1 = record.getDestinations().get(0);
-    assertEquals(DST_NS_0, location1.getNameserviceId());
-    assertEquals(DST_PATH_0, location1.getDest());
-
-    RemoteLocation location2 = record.getDestinations().get(1);
-    assertEquals(DST_NS_1, location2.getNameserviceId());
-    assertEquals(DST_PATH_1, location2.getDest());
-  }
-
-  @Test
-  public void testValidation() throws IOException {
-    Map<String, String> destinations = new HashMap<>();
-    destinations.put("ns0", "/testValidate-dest");
-    try {
-      MountTable.newInstance("testValidate", destinations);
-      fail("Mount table entry should be created failed.");
-    } catch (Exception e) {
-      GenericTestUtils.assertExceptionContains(
-          MountTable.ERROR_MSG_MUST_START_WITH_BACK_SLASH, e);
-    }
-
-    destinations.clear();
-    destinations.put("ns0", "testValidate-dest");
-    try {
-      MountTable.newInstance("/testValidate", destinations);
-      fail("Mount table entry should be created failed.");
-    } catch (Exception e) {
-      GenericTestUtils.assertExceptionContains(
-          MountTable.ERROR_MSG_ALL_DEST_MUST_START_WITH_BACK_SLASH, e);
-    }
-
-    destinations.clear();
-    destinations.put("", "/testValidate-dest");
-    try {
-      MountTable.newInstance("/testValidate", destinations);
-      fail("Mount table entry should be created failed.");
-    } catch (Exception e) {
-      GenericTestUtils.assertExceptionContains(
-          MountTable.ERROR_MSG_INVAILD_DEST_NS, e);
-    }
-
-    destinations.clear();
-    destinations.put("ns0", "/testValidate-dest");
-    MountTable record = MountTable.newInstance("/testValidate", destinations);
-    assertNotNull(record);
-
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hadoop/blob/62a819d5/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/federation/store/records/TestRouterState.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/federation/store/records/TestRouterState.java
 
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/federation/store/records/TestRouterState.java
deleted file mode 100644
index dfe2bc9..0000000
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/federation/store/records/TestRouterState.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hdfs.server.federation.store.records;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-
-import org.apache.hadoop.hdfs.server.federation.router.RouterServiceState;
-import 
org.apache.hadoop.hdfs.server.federation.store.driver.StateStoreSerializer;
-import org.junit.Test;
-
-/**
- * Test the Router State records.
- */
-public class TestRouterState {
-
-  private static final String ADDRESS = "address";
-  private static final String VERSION = "version";
-  private static final String COMPILE_INFO = "compileInfo";
-  private static final long START_TIME = 100;
-  private static final long DATE_MODIFIED = 200;
-  private static final long DATE_CREATED = 300;
-  private static final long FILE_RESOLVER_VERSION = 500;
-  private static final RouterServiceState STATE = RouterServiceState.RUNNING;
-
-
-  private RouterState generateRecord() throws IOException {
-    RouterState record = RouterState.newInstance(ADDRESS, START_TIME, STATE);
-    record.setVersion(VERSION);
-    record.setCompileInfo(COMPILE_INFO);
-    record.setDateCreated(DATE_CREATED);
-    record.setDateModified(DATE_MODIFIED);
-
-    StateStoreVersion version = StateStoreVersion.newInstance();
-    version.setMountTableVersion(FILE_RESOLVER_VERSION);
-    record.setStateStoreVersion(version);
-    return record;
-  }
-
-  private void validateRecord(RouterState record) throws IOException {
-    assertEquals(ADDRESS, record.getAddress());
-    assertEquals(START_TIME, record.getDateStarted());
-    assertEquals(STATE, record.getStatus());
-    assertEquals(COMPILE_INFO, record.getCompileInfo());
-    assertEquals(VERSION, record.getVersion());
-
-    StateStoreVersion version = record.getStateStoreVersion();
-    assertEquals(FILE_RESOLVER_VERSION, version.getMountTableVersion());
-  }
-
-  @Test
-  public void testGetterSetter() throws IOException {
-    RouterState record = generateRecord();
-    validateRecord(record);
-  }
-
-  @Test
-  public void testSerialization() throws IOException {
-
-    RouterState record = generateRecord();
-
-    StateStoreSerializer serializer = StateStoreSerializer.getSerializer();
-    String serializedString = serializer.serializeString(record);
-    RouterState newRecord =
-        serializer.deserialize(serializedString, RouterState.class);
-
-    validateRecord(newRecord);
-  }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/62a819d5/hadoop-hdfs-project/pom.xml
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/pom.xml b/hadoop-hdfs-project/pom.xml
index b557f26..d2ab7b4 100644
--- a/hadoop-hdfs-project/pom.xml
+++ b/hadoop-hdfs-project/pom.xml
@@ -35,6 +35,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd";>
     <module>hadoop-hdfs-native-client</module>
     <module>hadoop-hdfs-httpfs</module>
     <module>hadoop-hdfs-nfs</module>
+    <module>hadoop-hdfs-rbf</module>
   </modules>
 
   <build>

http://git-wip-us.apache.org/repos/asf/hadoop/blob/62a819d5/hadoop-project/pom.xml
----------------------------------------------------------------------
diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml
index 3c04470..16c7a36 100644
--- a/hadoop-project/pom.xml
+++ b/hadoop-project/pom.xml
@@ -248,6 +248,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.hadoop</groupId>
+        <artifactId>hadoop-hdfs-rbf</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.hadoop</groupId>
         <artifactId>hadoop-hdfs</artifactId>
         <version>${project.version}</version>
         <type>test-jar</type>

http://git-wip-us.apache.org/repos/asf/hadoop/blob/62a819d5/hadoop-project/src/site/site.xml
----------------------------------------------------------------------
diff --git a/hadoop-project/src/site/site.xml b/hadoop-project/src/site/site.xml
index 9d66d9f..4131d6b 100644
--- a/hadoop-project/src/site/site.xml
+++ b/hadoop-project/src/site/site.xml
@@ -104,7 +104,7 @@
       <item name="Disk Balancer" 
href="hadoop-project-dist/hadoop-hdfs/HDFSDiskbalancer.html"/>
       <item name="Upgrade Domain" 
href="hadoop-project-dist/hadoop-hdfs/HdfsUpgradeDomain.html"/>
       <item name="DataNode Admin" 
href="hadoop-project-dist/hadoop-hdfs/HdfsDataNodeAdminGuide.html"/>
-      <item name="Router Federation" 
href="hadoop-project-dist/hadoop-hdfs/HDFSRouterFederation.html"/>
+      <item name="Router Federation" 
href="hadoop-project-dist/hadoop-hdfs-rbf/HDFSRouterFederation.html"/>
     </menu>
 
     <menu name="MapReduce" inherit="top">
@@ -194,6 +194,7 @@
     <menu name="Configuration" inherit="top">
       <item name="core-default.xml" 
href="hadoop-project-dist/hadoop-common/core-default.xml"/>
       <item name="hdfs-default.xml" 
href="hadoop-project-dist/hadoop-hdfs/hdfs-default.xml"/>
+      <item name="hdfs-rbf-default.xml" 
href="hadoop-project-dist/hadoop-hdfs-rbf/hdfs-rbf-default.xml"/>
       <item name="mapred-default.xml" 
href="hadoop-mapreduce-client/hadoop-mapreduce-client-core/mapred-default.xml"/>
       <item name="yarn-default.xml" 
href="hadoop-yarn/hadoop-yarn-common/yarn-default.xml"/>
       <item name="Deprecated Properties" 
href="hadoop-project-dist/hadoop-common/DeprecatedProperties.html"/>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to