[08/74] [abbrv] hadoop git commit: YARN-7050. Post cleanup after YARN-6903, removal of org.apache.slider package. Contributed by Jian He
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2b3aff2f/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/test/java/org/apache/slider/common/tools/TestSliderUtils.java -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/test/java/org/apache/slider/common/tools/TestSliderUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/test/java/org/apache/slider/common/tools/TestSliderUtils.java deleted file mode 100644 index 057f6c5..000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/test/java/org/apache/slider/common/tools/TestSliderUtils.java +++ /dev/null @@ -1,134 +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.slider.common.tools; - -import org.apache.commons.io.FileUtils; -import org.apache.hadoop.yarn.api.records.ApplicationReport; -import org.apache.hadoop.yarn.api.records.YarnApplicationState; -import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationReportPBImpl; -import org.junit.Assert; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** Test slider util methods. */ -public class TestSliderUtils { - protected static final Logger log = - LoggerFactory.getLogger(TestSliderUtils.class); - @Rule - public TemporaryFolder folder = new TemporaryFolder(); - - //@Test - public void testTruncate() { -Assert.assertEquals(SliderUtils.truncate(null, 5), null); -Assert.assertEquals(SliderUtils.truncate("323", -1), "323"); -Assert.assertEquals(SliderUtils.truncate("3232", 5), "3232"); -Assert.assertEquals(SliderUtils.truncate("1234567890", 0), "1234567890"); -Assert.assertEquals(SliderUtils.truncate("123456789012345", 15), "123456789012345"); -Assert.assertEquals(SliderUtils.truncate("123456789012345", 14), "12345678901..."); -Assert.assertEquals(SliderUtils.truncate("1234567890", 1), "1"); -Assert.assertEquals(SliderUtils.truncate("1234567890", 10), "1234567890"); -Assert.assertEquals(SliderUtils.truncate("", 10), ""); - } - - //@Test - public void testApplicationReportComparison() { -List instances = getApplicationReports(); - -SliderUtils.sortApplicationsByMostRecent(instances); - -Assert.assertEquals(1000, instances.get(0).getStartTime()); -Assert.assertEquals(1000, instances.get(1).getStartTime()); -Assert.assertEquals(1000, instances.get(2).getStartTime()); -Assert.assertEquals(1000, instances.get(3).getStartTime()); - -instances = getApplicationReports(); - -SliderUtils.sortApplicationReport(instances); -Assert.assertEquals(1000, instances.get(0).getStartTime()); -Assert.assertEquals(1000, instances.get(1).getStartTime()); -Assert.assertEquals(1000, instances.get(2).getStartTime()); -Assert.assertEquals(1000, instances.get(3).getStartTime()); - -Assert.assertTrue(instances.get(0).getYarnApplicationState() == YarnApplicationState.ACCEPTED || - instances.get(0).getYarnApplicationState() == YarnApplicationState.RUNNING); -Assert.assertTrue(instances.get(1).getYarnApplicationState() == YarnApplicationState.ACCEPTED || - instances.get(1).getYarnApplicationState() == YarnApplicationState.RUNNING); -Assert.assertTrue(instances.get(2).getYarnApplicationState() == YarnApplicationState.ACCEPTED || - instances.get(2).getYarnApplicationState() == YarnApplicationState.RUNNING); -Assert.assertTrue(instances.get(3).getYarnApplicationState() == YarnApplicationState.KILLED); - } - - private List getApplicationReports() { -List instances = new ArrayList(); -instances.add(getApplicationReport(1000, 0, "app1", YarnApplicationState.ACCEPTED)); -instances.add(getApplicationReport(900, 998, "app1",
[08/74] [abbrv] hadoop git commit: YARN-7050. Post cleanup after YARN-6903, removal of org.apache.slider package. Contributed by Jian He
http://git-wip-us.apache.org/repos/asf/hadoop/blob/43277ffd/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/test/java/org/apache/slider/common/tools/TestSliderUtils.java -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/test/java/org/apache/slider/common/tools/TestSliderUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/test/java/org/apache/slider/common/tools/TestSliderUtils.java deleted file mode 100644 index 057f6c5..000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/test/java/org/apache/slider/common/tools/TestSliderUtils.java +++ /dev/null @@ -1,134 +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.slider.common.tools; - -import org.apache.commons.io.FileUtils; -import org.apache.hadoop.yarn.api.records.ApplicationReport; -import org.apache.hadoop.yarn.api.records.YarnApplicationState; -import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationReportPBImpl; -import org.junit.Assert; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** Test slider util methods. */ -public class TestSliderUtils { - protected static final Logger log = - LoggerFactory.getLogger(TestSliderUtils.class); - @Rule - public TemporaryFolder folder = new TemporaryFolder(); - - //@Test - public void testTruncate() { -Assert.assertEquals(SliderUtils.truncate(null, 5), null); -Assert.assertEquals(SliderUtils.truncate("323", -1), "323"); -Assert.assertEquals(SliderUtils.truncate("3232", 5), "3232"); -Assert.assertEquals(SliderUtils.truncate("1234567890", 0), "1234567890"); -Assert.assertEquals(SliderUtils.truncate("123456789012345", 15), "123456789012345"); -Assert.assertEquals(SliderUtils.truncate("123456789012345", 14), "12345678901..."); -Assert.assertEquals(SliderUtils.truncate("1234567890", 1), "1"); -Assert.assertEquals(SliderUtils.truncate("1234567890", 10), "1234567890"); -Assert.assertEquals(SliderUtils.truncate("", 10), ""); - } - - //@Test - public void testApplicationReportComparison() { -List instances = getApplicationReports(); - -SliderUtils.sortApplicationsByMostRecent(instances); - -Assert.assertEquals(1000, instances.get(0).getStartTime()); -Assert.assertEquals(1000, instances.get(1).getStartTime()); -Assert.assertEquals(1000, instances.get(2).getStartTime()); -Assert.assertEquals(1000, instances.get(3).getStartTime()); - -instances = getApplicationReports(); - -SliderUtils.sortApplicationReport(instances); -Assert.assertEquals(1000, instances.get(0).getStartTime()); -Assert.assertEquals(1000, instances.get(1).getStartTime()); -Assert.assertEquals(1000, instances.get(2).getStartTime()); -Assert.assertEquals(1000, instances.get(3).getStartTime()); - -Assert.assertTrue(instances.get(0).getYarnApplicationState() == YarnApplicationState.ACCEPTED || - instances.get(0).getYarnApplicationState() == YarnApplicationState.RUNNING); -Assert.assertTrue(instances.get(1).getYarnApplicationState() == YarnApplicationState.ACCEPTED || - instances.get(1).getYarnApplicationState() == YarnApplicationState.RUNNING); -Assert.assertTrue(instances.get(2).getYarnApplicationState() == YarnApplicationState.ACCEPTED || - instances.get(2).getYarnApplicationState() == YarnApplicationState.RUNNING); -Assert.assertTrue(instances.get(3).getYarnApplicationState() == YarnApplicationState.KILLED); - } - - private List getApplicationReports() { -List instances = new ArrayList(); -instances.add(getApplicationReport(1000, 0, "app1", YarnApplicationState.ACCEPTED)); -instances.add(getApplicationReport(900, 998, "app1",