flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ches...@apache.org
Subject [1/5] flink git commit: [FLINK-6715] Activate strict checkstyle for flink-mesos
Date Thu, 25 May 2017 18:49:42 GMT
Repository: flink
Updated Branches:
  refs/heads/master 0e69dd5cc -> 79b869498


http://git-wip-us.apache.org/repos/asf/flink/blob/0bca76ed/flink-mesos/src/test/java/org/apache/flink/mesos/runtime/clusterframework/MesosTaskManagerParametersTest.java
----------------------------------------------------------------------
diff --git a/flink-mesos/src/test/java/org/apache/flink/mesos/runtime/clusterframework/MesosTaskManagerParametersTest.java
b/flink-mesos/src/test/java/org/apache/flink/mesos/runtime/clusterframework/MesosTaskManagerParametersTest.java
index bc303e9..1f33cb5 100644
--- a/flink-mesos/src/test/java/org/apache/flink/mesos/runtime/clusterframework/MesosTaskManagerParametersTest.java
+++ b/flink-mesos/src/test/java/org/apache/flink/mesos/runtime/clusterframework/MesosTaskManagerParametersTest.java
@@ -7,7 +7,7 @@
  * "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
+ *	 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,
@@ -18,20 +18,26 @@
 
 package org.apache.flink.mesos.runtime.clusterframework;
 
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.util.TestLogger;
+
 import com.netflix.fenzo.ConstraintEvaluator;
 import com.netflix.fenzo.functions.Func1;
 import com.netflix.fenzo.plugins.HostAttrValueConstraint;
-import org.apache.flink.configuration.Configuration;
-import org.apache.flink.util.TestLogger;
 import org.apache.mesos.Protos;
 import org.junit.Test;
-import scala.Option;
 
 import java.util.List;
 
+import scala.Option;
+
 import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
 
+/**
+ * Tests for the {@link MesosTaskManagerParameters}.
+ */
 public class MesosTaskManagerParametersTest extends TestLogger {
 
 	@Test
@@ -56,12 +62,12 @@ public class MesosTaskManagerParametersTest extends TestLogger {
 		assertEquals(0, MesosTaskManagerParameters.buildVolumes(Option.<String>apply("")).size());
 	}
 
-	@Test(expected=IllegalArgumentException.class)
+	@Test(expected = IllegalArgumentException.class)
 	public void testBuildVolumesBadMode() throws Exception {
 		MesosTaskManagerParameters.buildVolumes(Option.<String>apply("/hp:/cp:RF"));
 	}
 
-	@Test(expected=IllegalArgumentException.class)
+	@Test(expected = IllegalArgumentException.class)
 	public void testBuildVolumesMalformed() throws Exception {
 		MesosTaskManagerParameters.buildVolumes(Option.<String>apply("/hp:/cp:ro:extra"));
 	}
@@ -77,66 +83,65 @@ public class MesosTaskManagerParametersTest extends TestLogger {
 		assertEquals("/host/path", params.containerVolumes().get(0).getHostPath());
 		assertEquals(Protos.Volume.Mode.RO, params.containerVolumes().get(0).getMode());
 	}
-	
+
+	@Test
+	public void givenTwoConstraintsInConfigShouldBeParsed() throws Exception {
+
+		MesosTaskManagerParameters mesosTaskManagerParameters = MesosTaskManagerParameters.create(withHardHostAttrConstraintConfiguration("cluster:foo,az:eu-west-1"));
+		assertThat(mesosTaskManagerParameters.constraints().size(), is(2));
+		ConstraintEvaluator firstConstraintEvaluator = new HostAttrValueConstraint("cluster", new
Func1<String, String>() {
+			@Override
+			public String call(String s) {
+				return "foo";
+			}
+		});
+		ConstraintEvaluator secondConstraintEvaluator = new HostAttrValueConstraint("az", new Func1<String,
String>() {
+			@Override
+			public String call(String s) {
+				return "foo";
+			}
+		});
+		assertThat(mesosTaskManagerParameters.constraints().get(0).getName(), is(firstConstraintEvaluator.getName()));
+		assertThat(mesosTaskManagerParameters.constraints().get(1).getName(), is(secondConstraintEvaluator.getName()));
+
+	}
+
+	@Test
+	public void givenOneConstraintInConfigShouldBeParsed() throws Exception {
+
+		MesosTaskManagerParameters mesosTaskManagerParameters = MesosTaskManagerParameters.create(withHardHostAttrConstraintConfiguration("cluster:foo"));
+		assertThat(mesosTaskManagerParameters.constraints().size(), is(1));
+		ConstraintEvaluator firstConstraintEvaluator = new HostAttrValueConstraint("cluster", new
Func1<String, String>() {
+			@Override
+			public String call(String s) {
+				return "foo";
+			}
+		});
+		assertThat(mesosTaskManagerParameters.constraints().get(0).getName(), is(firstConstraintEvaluator.getName()));
+	}
+
 	@Test
-    public void givenTwoConstraintsInConfigShouldBeParsed() throws Exception {
-
-        MesosTaskManagerParameters mesosTaskManagerParameters = MesosTaskManagerParameters.create(withHardHostAttrConstraintConfiguration("cluster:foo,az:eu-west-1"));
-        assertThat(mesosTaskManagerParameters.constraints().size(), is(2));
-        ConstraintEvaluator firstConstraintEvaluator = new HostAttrValueConstraint("cluster",
new Func1<String, String>() {
-            @Override
-            public String call(String s) {
-                return "foo";
-            }
-        });
-        ConstraintEvaluator secondConstraintEvaluator = new HostAttrValueConstraint("az",
new Func1<String, String>() {
-            @Override
-            public String call(String s) {
-                return "foo";
-            }
-        });
-        assertThat(mesosTaskManagerParameters.constraints().get(0).getName(), is(firstConstraintEvaluator.getName()));
-        assertThat(mesosTaskManagerParameters.constraints().get(1).getName(), is(secondConstraintEvaluator.getName()));
-
-    }
-
-    @Test
-    public void givenOneConstraintInConfigShouldBeParsed() throws Exception {
-
-        MesosTaskManagerParameters mesosTaskManagerParameters = MesosTaskManagerParameters.create(withHardHostAttrConstraintConfiguration("cluster:foo"));
-        assertThat(mesosTaskManagerParameters.constraints().size(), is(1));
-        ConstraintEvaluator firstConstraintEvaluator = new HostAttrValueConstraint("cluster",
new Func1<String, String>() {
-            @Override
-            public String call(String s) {
-                return "foo";
-            }
-        });
-        assertThat(mesosTaskManagerParameters.constraints().get(0).getName(), is(firstConstraintEvaluator.getName()));
-    }
-
-    @Test
-    public void givenEmptyConstraintInConfigShouldBeParsed() throws Exception {
-
-        MesosTaskManagerParameters mesosTaskManagerParameters = MesosTaskManagerParameters.create(withHardHostAttrConstraintConfiguration(""));
-        assertThat(mesosTaskManagerParameters.constraints().size(), is(0));
-    }
-
-    @Test
-    public void givenInvalidConstraintInConfigShouldBeParsed() throws Exception {
-
-        MesosTaskManagerParameters mesosTaskManagerParameters = MesosTaskManagerParameters.create(withHardHostAttrConstraintConfiguration(",:,"));
-        assertThat(mesosTaskManagerParameters.constraints().size(), is(0));
-    }
-
-
-    private static Configuration withHardHostAttrConstraintConfiguration(final String configuration)
{
-        return new Configuration() {
-            private static final long serialVersionUID = -3249384117909445760L;
-
-            {
-                setString(MesosTaskManagerParameters.MESOS_CONSTRAINTS_HARD_HOSTATTR, configuration);
-            }
-        };
-    }
+	public void givenEmptyConstraintInConfigShouldBeParsed() throws Exception {
+
+		MesosTaskManagerParameters mesosTaskManagerParameters = MesosTaskManagerParameters.create(withHardHostAttrConstraintConfiguration(""));
+		assertThat(mesosTaskManagerParameters.constraints().size(), is(0));
+	}
+
+	@Test
+	public void givenInvalidConstraintInConfigShouldBeParsed() throws Exception {
+
+		MesosTaskManagerParameters mesosTaskManagerParameters = MesosTaskManagerParameters.create(withHardHostAttrConstraintConfiguration(",:,"));
+		assertThat(mesosTaskManagerParameters.constraints().size(), is(0));
+	}
+
+	private static Configuration withHardHostAttrConstraintConfiguration(final String configuration)
{
+		return new Configuration() {
+			private static final long serialVersionUID = -3249384117909445760L;
+
+			{
+				setString(MesosTaskManagerParameters.MESOS_CONSTRAINTS_HARD_HOSTATTR, configuration);
+			}
+		};
+	}
 
 }


Mime
View raw message