commit_id
stringlengths 40
40
| project
stringclasses 90
values | commit_message
stringlengths 5
2.21k
| type
stringclasses 3
values | url
stringclasses 89
values | git_diff
stringlengths 283
4.32M
|
|---|---|---|---|---|---|
22b7e1b8fb3c0c7fc78decad7e918127ef32b43c
|
Vala
|
x11: fix type mismatch warning in X.Display.get_window_property
Fixes bug 609561.
|
c
|
https://github.com/GNOME/vala/
|
diff --git a/vapi/x11.vapi b/vapi/x11.vapi
index 6464014a06..5257a981e6 100644
--- a/vapi/x11.vapi
+++ b/vapi/x11.vapi
@@ -94,7 +94,7 @@ namespace X {
public void get_window_attributes (Window w, out WindowAttributes window_attributes_return);
[CCode (cname = "XGetWindowProperty")]
- public int get_window_property (Window w, Atom property, long long_offset, long long_length, bool delete, Atom req_type, out Atom actual_type_return, out int actual_format_return, out ulong nitems_return, out ulong bytes_after_return, out void* prop_return);
+ public int get_window_property (Window w, Atom property, long long_offset, long long_length, bool delete, Atom req_type, out Atom actual_type_return, out int actual_format_return, out ulong nitems_return, out ulong bytes_after_return, [CCode (type = "unsigned char **")] out void* prop_return);
[CCode (cname = "XGrabButton")]
public int grab_button (uint button, uint modifiers, Window grab_window, bool owner_events, uint event_mask, int pointer_mode, int keyboard_mode, Window confine_to, uint cursor);
|
86335c9fb2587613d01c926308bbdb00db1fb562
|
hbase
|
HBASE-2365 Double-assignment around split--git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@929856 13f79535-47bb-0310-9956-ffa450edef68-
|
c
|
https://github.com/apache/hbase
|
diff --git a/CHANGES.txt b/CHANGES.txt
index aaf62492aa23..abb1a3e238e6 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -257,7 +257,10 @@ Release 0.21.0 - Unreleased
HBASE-2358 Store doReconstructionLog will fail if oldlogfile.log is empty
and won't load region (Cosmin Lehene via Stack)
HBASE-2370 saveVersion.sh doesnt properly grab the git revision
+ HBASE-2373 Remove confusing log message of how "BaseScanner GET got
+ different address/startcode than SCAN"
HBASE-2361 WALEdit broke replication scope
+ HBASE-2365 Double-assignment around split
IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable
diff --git a/core/src/main/java/org/apache/hadoop/hbase/master/RegionManager.java b/core/src/main/java/org/apache/hadoop/hbase/master/RegionManager.java
index 636b4a95815f..24f9c14cced6 100644
--- a/core/src/main/java/org/apache/hadoop/hbase/master/RegionManager.java
+++ b/core/src/main/java/org/apache/hadoop/hbase/master/RegionManager.java
@@ -960,7 +960,7 @@ public void setUnassigned(HRegionInfo info, boolean force) {
regionsInTransition.put(info.getRegionNameAsString(), s);
}
}
- if (force || (!s.isPendingOpen() || !s.isOpen())) {
+ if (force || (!s.isPendingOpen() && !s.isOpen())) {
s.setUnassigned();
}
}
|
2f549a7f75f9af5b346335dbdf5ab1fa2d88cdec
|
uko$bummel
|
Improved BasicCircuit (.step) stability. Fixes gh-1
1. Added element's port connection presence check in the step method - to compute only used ports.
2. Added fix-copy of XOR test with NOT element included into the scheme.
3. Removed assertion checks from ancestor XOR test, now it is used as a crash test.
4. Numbered test output string - to see what exactly test were run and in what order.
5. All logic elements tests have passed successfully ^_^.
|
p
|
https://github.com/uko/bummel
|
diff --git a/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/AnalyzerTest.java b/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/AnalyzerTest.java
index 51d36c4..f5cccdd 100644
--- a/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/AnalyzerTest.java
+++ b/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/AnalyzerTest.java
@@ -44,7 +44,7 @@ public void tearDown()
@Test
public void testProcess0()
{
- System.out.println("an_process");
+ System.out.println("an_process0");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 0.);
Map expResult = new TreeMap<Integer, Double>();
@@ -57,7 +57,7 @@ public void testProcess0()
@Test
public void testProcess1()
{
- System.out.println("an_process");
+ System.out.println("an_process1");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 1.);
Map expResult = new TreeMap<Integer, Double>();
diff --git a/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/AndTest.java b/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/AndTest.java
index 34615fe..43f3fce 100644
--- a/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/AndTest.java
+++ b/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/AndTest.java
@@ -44,7 +44,7 @@ public void tearDown()
@Test
public void testProcess000()
{
- System.out.println("and_process");
+ System.out.println("and_process000");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 0.);
valuesOnPorts.put(1, 0.);
@@ -60,7 +60,7 @@ public void testProcess000()
@Test
public void testProcess001()
{
- System.out.println("and_process");
+ System.out.println("and_process001");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 0.);
valuesOnPorts.put(1, 0.);
@@ -76,7 +76,7 @@ public void testProcess001()
@Test
public void testProcess010()
{
- System.out.println("and_process");
+ System.out.println("and_process010");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 0.);
valuesOnPorts.put(1, 1.);
@@ -92,7 +92,7 @@ public void testProcess010()
@Test
public void testProcess011()
{
- System.out.println("and_process");
+ System.out.println("and_process011");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 0.);
valuesOnPorts.put(1, 1.);
@@ -108,7 +108,7 @@ public void testProcess011()
@Test
public void testProcess100()
{
- System.out.println("and_process");
+ System.out.println("and_process100");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 1.);
valuesOnPorts.put(1, 0.);
@@ -124,7 +124,7 @@ public void testProcess100()
@Test
public void testProcess101()
{
- System.out.println("and_process");
+ System.out.println("and_process101");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 1.);
valuesOnPorts.put(1, 0.);
@@ -140,7 +140,7 @@ public void testProcess101()
@Test
public void testProcess110()
{
- System.out.println("and_process");
+ System.out.println("and_process110");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 1.);
valuesOnPorts.put(1, 1.);
@@ -156,7 +156,7 @@ public void testProcess110()
@Test
public void testProcess111()
{
- System.out.println("and_process");
+ System.out.println("and_process111");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 1.);
valuesOnPorts.put(1, 1.);
diff --git a/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/GeneratorTest.java b/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/GeneratorTest.java
index ac1c23b..78d6a5d 100644
--- a/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/GeneratorTest.java
+++ b/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/GeneratorTest.java
@@ -44,7 +44,7 @@ public void tearDown()
@Test
public void testProcess0_0()
{
- System.out.println("gen_process");
+ System.out.println("gen_process0_0");
instance.setState(0);
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 0.);
@@ -57,7 +57,7 @@ public void testProcess0_0()
@Test
public void testProcess0_1()
{
- System.out.println("gen_process");
+ System.out.println("gen_process0_1");
instance.setState(1);
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 0.);
@@ -70,7 +70,7 @@ public void testProcess0_1()
@Test
public void testProcess1_0()
{
- System.out.println("gen_process");
+ System.out.println("gen_process1_0");
instance.setState(0);
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 1.);
@@ -83,7 +83,7 @@ public void testProcess1_0()
@Test
public void testProcess1_1()
{
- System.out.println("gen_process");
+ System.out.println("gen_process1_1");
instance.setState(1);
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 1.);
diff --git a/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/NotTest.java b/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/NotTest.java
index ea5a959..abdd927 100644
--- a/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/NotTest.java
+++ b/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/NotTest.java
@@ -44,7 +44,7 @@ public void tearDown()
@Test
public void testProcess00()
{
- System.out.println("not_process");
+ System.out.println("not_process00");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 0.);
valuesOnPorts.put(1, 0.);
@@ -58,7 +58,7 @@ public void testProcess00()
@Test
public void testProcess01()
{
- System.out.println("not_process");
+ System.out.println("not_process01");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 0.);
valuesOnPorts.put(1, 1.);
@@ -72,7 +72,7 @@ public void testProcess01()
@Test
public void testProcess10()
{
- System.out.println("not_process");
+ System.out.println("not_process10");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 1.);
valuesOnPorts.put(1, 0.);
@@ -86,7 +86,7 @@ public void testProcess10()
@Test
public void testProcess11()
{
- System.out.println("not_process");
+ System.out.println("not_process11");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 1.);
valuesOnPorts.put(1, 1.);
diff --git a/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/OrTest.java b/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/OrTest.java
index b6054ed..0b29650 100644
--- a/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/OrTest.java
+++ b/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/OrTest.java
@@ -44,7 +44,7 @@ public void tearDown()
@Test
public void testProcess000()
{
- System.out.println("or_process");
+ System.out.println("or_process000");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 0.);
valuesOnPorts.put(1, 0.);
@@ -60,7 +60,7 @@ public void testProcess000()
@Test
public void testProcess001()
{
- System.out.println("or_process");
+ System.out.println("or_process001");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 0.);
valuesOnPorts.put(1, 0.);
@@ -76,7 +76,7 @@ public void testProcess001()
@Test
public void testProcess010()
{
- System.out.println("or_process");
+ System.out.println("or_process010");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 0.);
valuesOnPorts.put(1, 1.);
@@ -92,7 +92,7 @@ public void testProcess010()
@Test
public void testProcess011()
{
- System.out.println("or_process");
+ System.out.println("or_process011");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 0.);
valuesOnPorts.put(1, 1.);
@@ -108,7 +108,7 @@ public void testProcess011()
@Test
public void testProcess100()
{
- System.out.println("or_process");
+ System.out.println("or_process100");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 1.);
valuesOnPorts.put(1, 0.);
@@ -124,7 +124,7 @@ public void testProcess100()
@Test
public void testProcess101()
{
- System.out.println("or_process");
+ System.out.println("or_process101");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 1.);
valuesOnPorts.put(1, 0.);
@@ -140,7 +140,7 @@ public void testProcess101()
@Test
public void testProcess110()
{
- System.out.println("or_process");
+ System.out.println("or_process110");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 1.);
valuesOnPorts.put(1, 1.);
@@ -156,7 +156,7 @@ public void testProcess110()
@Test
public void testProcess111()
{
- System.out.println("or_process");
+ System.out.println("or_process111");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 1.);
valuesOnPorts.put(1, 1.);
diff --git a/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/SchemeTest.java b/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/SchemeTest.java
index 1695e0e..b232b0d 100644
--- a/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/SchemeTest.java
+++ b/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/SchemeTest.java
@@ -7,10 +7,6 @@
import org.openide.util.Lookup;
import static org.junit.Assert.*;
-/**
- *
- * @author mcangel
- */
public class SchemeTest
{
Circuit instance;
@@ -31,7 +27,7 @@ public void tearDown()
@Test
public void testSchemeN1()
{
- System.out.println("scheme_process");
+ System.out.println("scheme_processN1");
Generator gen = new Generator();
Analyzer an = new Analyzer();
instance.addElement(gen);
@@ -51,7 +47,7 @@ public void testSchemeN1()
@Test
public void testSchemeN2()
{
- System.out.println("scheme_process");
+ System.out.println("scheme_processN2");
Generator gen = new Generator();
Not no = new Not();
Analyzer an = new Analyzer();
@@ -80,7 +76,7 @@ public void testSchemeN2()
@Test
public void testSchemeN3()
{
- System.out.println("scheme_process");
+ System.out.println("scheme_processN3");
Generator gen1 = new Generator();
Generator gen2 = new Generator();
And and = new And();
@@ -119,7 +115,7 @@ public void testSchemeN3()
@Test
public void testSchemeN4()
{
- System.out.println("scheme_process");
+ System.out.println("scheme_processN4");
Generator gen1 = new Generator();
Generator gen2 = new Generator();
Or or = new Or();
@@ -158,7 +154,7 @@ public void testSchemeN4()
@Test
public void testSchemeN5()
{
- System.out.println("scheme_process");
+ System.out.println("scheme_processN5");
Generator gen1 = new Generator();
Generator gen2 = new Generator();
Generator gen3 = new Generator();
@@ -212,7 +208,7 @@ public void testSchemeN5()
@Test
public void testSchemeN6()
{
- System.out.println("scheme_process");
+ System.out.println("scheme_processN6");
Generator gen1 = new Generator();
Generator gen2 = new Generator();
Generator gen3 = new Generator();
@@ -260,64 +256,128 @@ public void testSchemeN6()
assertEquals(1, an.getState());
}
-// /**
-// * XOR
-// */
-// @Test
-// public void testSchemeN7()
-// {
-// System.out.println("scheme_process");
-// Generator gen1 = new Generator();
-// Generator gen2 = new Generator();
-// Not not = new Not();
-// Or or = new Or();
-// And and1 = new And();
-// And and2 = new And();
-// Split spl1 = new Split();
-// Split spl2 = new Split();
-// Analyzer an = new Analyzer();
-// instance.addElement(gen1);
-// instance.addElement(gen2);
-// instance.addElement(or);
-// instance.addElement(and1);
-// instance.addElement(and2);
-// instance.addElement(spl1);
-// instance.addElement(spl2);
-// instance.addElement(an);
-// instance.connectElements(gen1, 0, spl1, 0);
-// instance.connectElements(gen2, 0, spl2, 0);
-// instance.connectElements(spl1, 1, or, 0);
-// instance.connectElements(spl2, 1, or, 1);
-// instance.connectElements(spl1, 2, and1, 0);
-// instance.connectElements(spl2, 2, and1, 1);
-// instance.connectElements(or, 2, and2, 0);
-// instance.connectElements(and1, 2, not, 0);
-// instance.connectElements(not, 1, and2, 1);
-// instance.connectElements(and2, 2, an, 0);
-// gen1.setState(1);
-// gen2.setState(0);
-// for (int i = 0; i < 10; i++)
-// {
-// instance.step();
-// }
-// assertEquals(1, an.getState());
-// gen2.setState(1);
-// for (int i = 0; i < 10; i++)
-// {
-// instance.step();
-// }
-// assertEquals(0, an.getState());
-// gen1.setState(0);
-// for (int i = 0; i < 10; i++)
-// {
-// instance.step();
-// }
-// assertEquals(1, an.getState());
-// gen2.setState(0);
-// for (int i = 0; i < 10; i++)
-// {
-// instance.step();
-// }
-// assertEquals(0, an.getState());
-// }
+ /**
+ * A test without the NOT element added into the scheme
+ * (was the source of NullPointerException).
+ * XOR:
+ * an = and2( or(spl1-gen1, spl2-gen2),
+ * not(and1(spl1-gen1, spl2-gen2)))
+ */
+ @Test
+ public void testSchemeN7CrashTest()
+ {
+ System.out.println("scheme_processN7_CrashTest");
+ Generator gen1 = new Generator();
+ Generator gen2 = new Generator();
+ Not not = new Not();
+ Or or = new Or();
+ And and1 = new And();
+ And and2 = new And();
+ Split spl1 = new Split();
+ Split spl2 = new Split();
+ Analyzer an = new Analyzer();
+ instance.addElement(gen1);
+ instance.addElement(gen2);
+ instance.addElement(or);
+ instance.addElement(and1);
+ instance.addElement(and2);
+ instance.addElement(spl1);
+ instance.addElement(spl2);
+ instance.addElement(an);
+ instance.connectElements(gen1, 0, spl1, 0);
+ instance.connectElements(gen2, 0, spl2, 0);
+ instance.connectElements(spl1, 1, or, 0);
+ instance.connectElements(spl2, 1, or, 1);
+ instance.connectElements(spl1, 2, and1, 0);
+ instance.connectElements(spl2, 2, and1, 1);
+ instance.connectElements(and1, 2, not, 0);
+ instance.connectElements(or, 2, and2, 0);
+ instance.connectElements(not, 1, and2, 1);
+ instance.connectElements(and2, 2, an, 0);
+ gen1.setState(1);
+ gen2.setState(0);
+ for (int i = 0; i < 10; i++)
+ {
+ instance.step();
+ }
+ gen2.setState(1);
+ for (int i = 0; i < 10; i++)
+ {
+ instance.step();
+ }
+ gen1.setState(0);
+ for (int i = 0; i < 10; i++)
+ {
+ instance.step();
+ }
+ gen2.setState(0);
+ for (int i = 0; i < 10; i++)
+ {
+ instance.step();
+ }
+ }
+
+ /**
+ * XOR:
+ * an = and2( or(spl1-gen1, spl2-gen2),
+ * not(and1(spl1-gen1, spl2-gen2)))
+ */
+ @Test
+ public void testSchemeN8()
+ {
+ System.out.println("scheme_processN8");
+ Generator gen1 = new Generator();
+ Generator gen2 = new Generator();
+ Not not = new Not();
+ Or or = new Or();
+ And and1 = new And();
+ And and2 = new And();
+ Split spl1 = new Split();
+ Split spl2 = new Split();
+ Analyzer an = new Analyzer();
+ instance.addElement(gen1);
+ instance.addElement(gen2);
+ instance.addElement(or);
+ instance.addElement(not);
+ instance.addElement(and1);
+ instance.addElement(and2);
+ instance.addElement(spl1);
+ instance.addElement(spl2);
+ instance.addElement(an);
+ instance.connectElements(gen1, 0, spl1, 0);
+ instance.connectElements(gen2, 0, spl2, 0);
+ instance.connectElements(spl1, 1, or, 0);
+ instance.connectElements(spl2, 1, or, 1);
+ instance.connectElements(spl1, 2, and1, 0);
+ instance.connectElements(spl2, 2, and1, 1);
+ instance.connectElements(and1, 2, not, 0);
+ instance.connectElements(or, 2, and2, 0);
+ instance.connectElements(not, 1, and2, 1);
+ instance.connectElements(and2, 2, an, 0);
+ gen1.setState(1);
+ gen2.setState(0);
+ for (int i = 0; i < 10; i++)
+ {
+ instance.step();
+ }
+ assertEquals(1, an.getState());
+ gen2.setState(1);
+ for (int i = 0; i < 10; i++)
+ {
+ instance.step();
+ }
+ assertEquals(0, an.getState());
+ gen1.setState(0);
+ for (int i = 0; i < 10; i++)
+ {
+ instance.step();
+ }
+ assertEquals(1, an.getState());
+ gen2.setState(0);
+ for (int i = 0; i < 10; i++)
+ {
+ instance.step();
+ }
+ assertEquals(0, an.getState());
+ }
}
diff --git a/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/SplitTest.java b/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/SplitTest.java
index 3e14902..813ad03 100644
--- a/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/SplitTest.java
+++ b/LogicElements/test/unit/src/net/unikernel/bummel/logic_elements/SplitTest.java
@@ -43,7 +43,7 @@ public void tearDown()
@Test
public void testProcess000()
{
- System.out.println("split_process");
+ System.out.println("split_process000");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 0.);
valuesOnPorts.put(1, 0.);
@@ -59,7 +59,7 @@ public void testProcess000()
@Test
public void testProcess001()
{
- System.out.println("split_process");
+ System.out.println("split_process001");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 0.);
valuesOnPorts.put(1, 0.);
@@ -75,7 +75,7 @@ public void testProcess001()
@Test
public void testProcess010()
{
- System.out.println("split_process");
+ System.out.println("split_process010");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 0.);
valuesOnPorts.put(1, 1.);
@@ -91,7 +91,7 @@ public void testProcess010()
@Test
public void testProcess011()
{
- System.out.println("split_process");
+ System.out.println("split_process011");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 0.);
valuesOnPorts.put(1, 1.);
@@ -107,7 +107,7 @@ public void testProcess011()
@Test
public void testProcess100()
{
- System.out.println("split_process");
+ System.out.println("split_process100");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 1.);
valuesOnPorts.put(1, 0.);
@@ -123,7 +123,7 @@ public void testProcess100()
@Test
public void testProcess101()
{
- System.out.println("split_process");
+ System.out.println("split_process101");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 1.);
valuesOnPorts.put(1, 0.);
@@ -139,7 +139,7 @@ public void testProcess101()
@Test
public void testProcess110()
{
- System.out.println("split_process");
+ System.out.println("split_process110");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 1.);
valuesOnPorts.put(1, 1.);
@@ -155,7 +155,7 @@ public void testProcess110()
@Test
public void testProcess111()
{
- System.out.println("split_process");
+ System.out.println("split_process111");
Map<Integer, Double> valuesOnPorts = new TreeMap<Integer, Double>();
valuesOnPorts.put(0, 1.);
valuesOnPorts.put(1, 1.);
diff --git a/ProjectModel/src/net/unikernel/bummel/project_model/BasicCircuit.java b/ProjectModel/src/net/unikernel/bummel/project_model/BasicCircuit.java
index 526eac7..bd0cef7 100644
--- a/ProjectModel/src/net/unikernel/bummel/project_model/BasicCircuit.java
+++ b/ProjectModel/src/net/unikernel/bummel/project_model/BasicCircuit.java
@@ -23,7 +23,7 @@ public class BasicCircuit implements Circuit, Element
private Point coords;
private Set<Element> elements;
private Map<Connection, Double> connections;
- private Map<Element, Map<Integer, Connection>> connectionsByElementAndPort;
+ private Map<Element, Map<Integer, Connection>> ElementPortConnection;
public BasicCircuit()
{
@@ -31,7 +31,7 @@ public BasicCircuit()
coords = new Point(0, 0);
elements = new HashSet<Element>();
connections = new HashMap<Connection, Double>();
- connectionsByElementAndPort = new HashMap<Element, Map<Integer, Connection>>();
+ ElementPortConnection = new HashMap<Element, Map<Integer, Connection>>();
}
@Override
@@ -51,22 +51,22 @@ public void connectElements(Element firstElement, Integer firstElementPort, Elem
if(elements.contains(firstElement) && elements.contains(secondElement))
{
//make a connection
- Connection temp = new Connection(firstElement, firstElementPort, secondElement, secondElementPort);
+ Connection conn = new Connection(firstElement, firstElementPort, secondElement, secondElementPort);
//put it in the connections
- connections.put(temp, 0.);
+ connections.put(conn, 0.);
//put it in the map of element->port->connection for each element+port pair
- if(!connectionsByElementAndPort.containsKey(firstElement))
+ if(!ElementPortConnection.containsKey(firstElement))
{
- connectionsByElementAndPort.put(firstElement, new HashMap<Integer, Connection>());
+ ElementPortConnection.put(firstElement, new HashMap<Integer, Connection>());
}
- if(!connectionsByElementAndPort.containsKey(secondElement))
+ if(!ElementPortConnection.containsKey(secondElement))
{
- connectionsByElementAndPort.put(secondElement, new HashMap<Integer, Connection>());
+ ElementPortConnection.put(secondElement, new HashMap<Integer, Connection>());
}
- connectionsByElementAndPort.get(firstElement).put(firstElementPort, temp);
- connectionsByElementAndPort.get(secondElement).put(secondElementPort, temp);
+ ElementPortConnection.get(firstElement).put(firstElementPort, conn);
+ ElementPortConnection.get(secondElement).put(secondElementPort, conn);
}
}
@@ -75,15 +75,15 @@ public void disconectElements(Element firstElement, Integer firstElementPort, El
{
if (connections.remove(new Connection(firstElement, firstElementPort, secondElement, secondElementPort))==null)
{
- connectionsByElementAndPort.get(firstElement).remove(firstElementPort);
- connectionsByElementAndPort.get(secondElement).remove(secondElementPort);
- if(connectionsByElementAndPort.get(secondElement).isEmpty())
+ ElementPortConnection.get(firstElement).remove(firstElementPort);
+ ElementPortConnection.get(secondElement).remove(secondElementPort);
+ if(ElementPortConnection.get(secondElement).isEmpty())
{
- connectionsByElementAndPort.remove(firstElement);
+ ElementPortConnection.remove(firstElement);
}
- if(connectionsByElementAndPort.get(firstElement).isEmpty())
+ if(ElementPortConnection.get(firstElement).isEmpty())
{
- connectionsByElementAndPort.remove(secondElement);
+ ElementPortConnection.remove(secondElement);
}
}
}
@@ -97,15 +97,39 @@ public void step()
}
for (Element i: elements)
{
- Map<Integer, Double> portsMap = new TreeMap<Integer, Double>();
- for (Map.Entry<Integer,Connection> j : connectionsByElementAndPort.get(i).entrySet())
+ //check whether element is at least connected to something
+ if(ElementPortConnection.containsKey(i))
{
- portsMap.put(j.getKey(), connections.get(j.getValue()));
- }
- portsMap = i.process(portsMap);
- for (Map.Entry<Integer,Double> j : portsMap.entrySet())
- {
- tempoMap.get(connectionsByElementAndPort.get(i).get(j.getKey())).add(j.getValue());
+ Map<Integer, Double> portsMap = new TreeMap<Integer, Double>();
+ //copy values from connections to the current element ports
+ for (Map.Entry<Integer, Connection> j : ElementPortConnection.get(i).entrySet())
+ {
+ portsMap.put(j.getKey(), connections.get(j.getValue()));
+ }
+ try
+ {
+ portsMap = i.process(portsMap);
+ } //ignore elements crashes
+ catch (NullPointerException ex)
+ {
+ //put 0s on the used ports
+ for (Integer j : i.getPorts())
+ {
+ //"used" means connected to something
+ if (ElementPortConnection.get(i).containsKey(j))
+ {
+ portsMap.put(j, 0.);
+ }
+ }
+ }
+ for (Map.Entry<Integer, Double> j : portsMap.entrySet())
+ {
+ //take output values only from present and used ports
+ if (ElementPortConnection.get(i).containsKey(j.getKey()))
+ {
+ tempoMap.get(ElementPortConnection.get(i).get(j.getKey())).add(j.getValue());
+ }
+ }
}
}
for (Map.Entry<Connection,ArrayList<Double>> i : tempoMap.entrySet())
diff --git a/ProjectModel/test/unit/src/net/unikernel/bummel/project_model/BasicCircuitTest.java b/ProjectModel/test/unit/src/net/unikernel/bummel/project_model/BasicCircuitTest.java
index 620f0d2..ad4dfa5 100644
--- a/ProjectModel/test/unit/src/net/unikernel/bummel/project_model/BasicCircuitTest.java
+++ b/ProjectModel/test/unit/src/net/unikernel/bummel/project_model/BasicCircuitTest.java
@@ -1,6 +1,9 @@
package net.unikernel.bummel.project_model;
+import org.junit.After;
+import org.junit.Before;
import java.awt.Point;
+import java.util.HashMap;
import java.util.Map;
import net.unikernel.bummel.project_model.api.BasicElement;
import net.unikernel.bummel.project_model.api.Element;
@@ -29,6 +32,18 @@ public static void tearDownClass() throws Exception
{
}
+ BasicCircuit instance;
+ @Before
+ public void setUp()
+ {
+ instance = new BasicCircuit();
+ }
+ @After
+ public void tearDown()
+ {
+ instance = null;
+ }
+
/**
* Test of addElement method, of class BasicCircuit.
*/
@@ -37,7 +52,6 @@ public void testAddElement()
{
System.out.println("addElement");
Element element = new BasicElementImpl();
- BasicCircuit instance = new BasicCircuit();
instance.addElement(element);
assertTrue(instance.getElements().contains(element));
}
@@ -50,7 +64,6 @@ public void testRemoveElement()
{
System.out.println("removeElement");
Element element = new BasicElementImpl();
- BasicCircuit instance = new BasicCircuit();
instance.addElement(element);
instance.removeElement(element);
assertFalse(instance.getElements().contains(element));
@@ -67,10 +80,7 @@ public void testConnectElements()
Integer firstElementPort = 0;
Element secondElement = new BasicElementImpl();
Integer secondElementPort = 1;
- BasicCircuit instance = new BasicCircuit();
instance.connectElements(firstElement, firstElementPort, secondElement, secondElementPort);
- //O_o
- //We can connect elements that are not in the circuit.
}
/**
@@ -84,13 +94,10 @@ public void testDisconectElements()
Integer firstElementPort = 0;
Element secondElement = new BasicElementImpl();
Integer secondElementPort = 1;
- BasicCircuit instance = new BasicCircuit();
instance.addElement(firstElement);
instance.addElement(secondElement);
instance.connectElements(firstElement, firstElementPort, secondElement, secondElementPort);
instance.disconectElements(firstElement, firstElementPort, secondElement, secondElementPort);
- //o_O
- //We can connect elements that are not in the circuit.
}
/**
@@ -104,13 +111,35 @@ public void testStep()
Integer firstElementPort = 0;
Element secondElement = new BasicElementImpl();
Integer secondElementPort = 1;
- BasicCircuit instance = new BasicCircuit();
instance.addElement(firstElement);
instance.addElement(secondElement);
instance.connectElements(firstElement, firstElementPort, secondElement, secondElementPort);
instance.step();
}
+ @Test
+ public void testStep2()
+ {
+ System.out.println("step2");
+ Element firstElement = new BasicElementImpl();
+ instance.addElement(firstElement);
+ instance.step();
+ }
+
+ @Test
+ public void testStep3()
+ {
+ System.out.println("step3");
+ Element elem1 = new BasicElementImpl();
+ Element elem2 = new BasicElementImpl();
+ Element elem3 = new BasicElementImpl();
+ instance.addElement(elem1);
+ instance.addElement(elem2);
+ instance.addElement(elem3);
+ instance.connectElements(elem1, elem1.getPorts().get(1), elem2, elem2.getPorts().get(0));
+ instance.step();
+ }
+
/**
* Test of getLabel method, of class BasicCircuit.
*/
@@ -118,7 +147,6 @@ public void testStep()
public void testGetLabel()
{
System.out.println("getLabel");
- BasicCircuit instance = new BasicCircuit();
String expResult = "";
String result = instance.getLabel();
assertEquals(expResult, result);
@@ -132,7 +160,6 @@ public void testSetLabel()
{
System.out.println("setLabel");
String label = "hello";
- BasicCircuit instance = new BasicCircuit();
instance.setLabel(label);
assertEquals(label, instance.getLabel());
}
@@ -144,12 +171,7 @@ public void testSetLabel()
public void testGetState()
{
System.out.println("getState");
- BasicCircuit instance = new BasicCircuit();
- int expResult = 0;
- int result = instance.getState();
- assertEquals(expResult, result);
- // TODO review the generated test code and remove the default call to fail.
- fail("The test case is a prototype.");
+ assertEquals(1, instance.getState());
}
/**
@@ -159,11 +181,7 @@ public void testGetState()
public void testSetState()
{
System.out.println("setState");
- int state = 0;
- BasicCircuit instance = new BasicCircuit();
- instance.setState(state);
- // TODO review the generated test code and remove the default call to fail.
- fail("The test case is a prototype.");
+ instance.setState(0);
}
/**
@@ -173,7 +191,6 @@ public void testSetState()
public void testGetCoords()
{
System.out.println("getCoords");
- BasicCircuit instance = new BasicCircuit();
Point expResult = new Point(0, 0);
Point result = instance.getCoords();
assertEquals(expResult, result);
@@ -187,7 +204,6 @@ public void testSetCoords()
{
System.out.println("setCoords");
Point point = new Point(13, 25);
- BasicCircuit instance = new BasicCircuit();
instance.setCoords(point);
Point result = instance.getCoords();
assertEquals(point, result);
@@ -200,13 +216,7 @@ public void testSetCoords()
public void testProcess()
{
System.out.println("process");
- Map<Integer, Double> valuesOnPorts = null;
- BasicCircuit instance = new BasicCircuit();
- Map expResult = null;
- Map result = instance.process(valuesOnPorts);
- assertEquals(expResult, result);
- // TODO review the generated test code and remove the default call to fail.
- fail("The test case is a prototype.");
+ assertEquals(null, instance.process(null));
}
/**
@@ -225,7 +235,14 @@ public BasicElementImpl()
@Override
public Map<Integer, Double> process(Map<Integer, Double> valuesOnPorts)
{
- return valuesOnPorts;
+ //evil code to crash scheme ]:P
+ HashMap<Integer, Double> map = new HashMap<Integer, Double>();
+ map.put(0, 0.);
+ map.put(1, 1.);
+ map.put(2, 0.);
+ map.put(3, 1.);
+ map.put(4, 0.);
+ return map;
}
}
diff --git a/ProjectModel/test/unit/src/net/unikernel/bummel/project_model/Project_modelSuite.java b/ProjectModel/test/unit/src/net/unikernel/bummel/project_model/Project_modelSuite.java
index 424eb93..27dcc19 100644
--- a/ProjectModel/test/unit/src/net/unikernel/bummel/project_model/Project_modelSuite.java
+++ b/ProjectModel/test/unit/src/net/unikernel/bummel/project_model/Project_modelSuite.java
@@ -13,7 +13,12 @@
*/
@RunWith(Suite.class)
@Suite.SuiteClasses(
-{net.unikernel.bummel.project_model.BasicConnectionTest.class, net.unikernel.bummel.project_model.BasicCircuitTest.class, net.unikernel.bummel.project_model.api.ApiSuite.class, net.unikernel.bummel.project_model.ProjectModelTest.class})
+{
+ net.unikernel.bummel.project_model.BasicConnectionTest.class,
+ net.unikernel.bummel.project_model.BasicCircuitTest.class,
+ net.unikernel.bummel.project_model.api.ApiSuite.class,
+ net.unikernel.bummel.project_model.ProjectModelTest.class
+})
public class Project_modelSuite
{
|
af936076fdb57ab158ce924fe5d9bbb4f2dd1846
|
restlet-framework-java
|
- Renamed Representation-write(Appendable) to- append(Appendable).--
|
p
|
https://github.com/restlet/restlet-framework-java
|
diff --git a/build/tmpl/text/changes.txt b/build/tmpl/text/changes.txt
index 5c1695ad47..eceb60d26d 100644
--- a/build/tmpl/text/changes.txt
+++ b/build/tmpl/text/changes.txt
@@ -33,7 +33,7 @@ Changes log
convenient shortcuts.
- Added ClientResource#handleInbound(...) and handleOutbound(...)
method to factorize even more logic.
- - Added Representation#write(Appendable) method.
+ - Added Representation#append(Appendable) method.
- New features
- Added a CookieAuthenticator class in the org.restlet.ext.crypto
extension to provide customizable and secure authentication via
diff --git a/modules/org.restlet.test/src/org/restlet/test/ext/oauth/MultipleUserAuthorizationServerTestCase.java b/modules/org.restlet.test/src/org/restlet/test/ext/oauth/MultipleUserAuthorizationServerTestCase.java
index 6e26c57533..6849fec22a 100644
--- a/modules/org.restlet.test/src/org/restlet/test/ext/oauth/MultipleUserAuthorizationServerTestCase.java
+++ b/modules/org.restlet.test/src/org/restlet/test/ext/oauth/MultipleUserAuthorizationServerTestCase.java
@@ -68,7 +68,8 @@ public void testMultipleServerRequests() throws Exception {
int numThreads = 10;
int numCalls = 50;
int totCalls = (numThreads * numCalls);
- List<OAuthRequest> calls = new ArrayList<OAuthRequest>(totCalls);
+ List<Callable<Boolean>> calls = new ArrayList<Callable<Boolean>>(
+ totCalls);
ExecutorService es = Executors.newFixedThreadPool(numThreads);
Client c = this.createClient();
Random r = new Random();
diff --git a/modules/org.restlet/src/org/restlet/representation/Representation.java b/modules/org.restlet/src/org/restlet/representation/Representation.java
index df5f811150..15aa3166aa 100644
--- a/modules/org.restlet/src/org/restlet/representation/Representation.java
+++ b/modules/org.restlet/src/org/restlet/representation/Representation.java
@@ -217,6 +217,21 @@ public Representation(Variant variant, Tag tag) {
this(variant, null, tag);
}
+ /**
+ * Appends the representation to an appendable sequence of characters. This
+ * method is ensured to write the full content for each invocation unless it
+ * is a transient representation, in which case an exception is thrown.<br>
+ * <br>
+ * Note that {@link #getText()} is used by the default implementation.
+ *
+ * @param appendable
+ * The appendable sequence of characters.
+ * @throws IOException
+ */
+ public void append(Appendable appendable) throws IOException {
+ appendable.append(getText());
+ }
+
/**
* Exhaust the content of the representation by reading it and silently
* discarding anything read. By default, it relies on {@link #getStream()}
@@ -412,6 +427,16 @@ public boolean isAvailable() {
return this.available && (getSize() != 0);
}
+ // [ifdef gwt] method uncomment
+ // /**
+ // * Converts the representation to a string value. Be careful when using
+ // * this method as the conversion of large content to a string fully
+ // * stored in memory can result in OutOfMemoryErrors being thrown.
+ // *
+ // * @return The representation as a string value.
+ // */
+ // public abstract String getText() throws IOException;
+
// [ifndef gwt] method
/**
* Indicates if the representation content supports NIO selection. In this
@@ -431,16 +456,6 @@ public boolean isSelectable() {
}
}
- // [ifdef gwt] method uncomment
- // /**
- // * Converts the representation to a string value. Be careful when using
- // * this method as the conversion of large content to a string fully
- // * stored in memory can result in OutOfMemoryErrors being thrown.
- // *
- // * @return The representation as a string value.
- // */
- // public abstract String getText() throws IOException;
-
/**
* Indicates if the representation's content is transient, which means that
* it can be obtained only once. This is often the case with representations
@@ -594,21 +609,6 @@ public void setTransient(boolean isTransient) {
this.isTransient = isTransient;
}
- /**
- * Writes the representation to an appendable sequence of characters. This
- * method is ensured to write the full content for each invocation unless it
- * is a transient representation, in which case an exception is thrown.<br>
- * <br>
- * Note that {@link #getText()} is used by the default implementation.
- *
- * @param appendable
- * The appendable sequence of characters.
- * @throws IOException
- */
- public void write(Appendable appendable) throws IOException {
- appendable.append(getText());
- }
-
// [ifndef gwt] member
/**
* Writes the representation to a characters writer. This method is ensured
|
12060cb9a634e3b1ae0b7d1508bedd37e3dc0394
|
hadoop
|
YARN-3028. Better syntax for replaceLabelsOnNode in- RMAdmin CLI. Contributed by Rohith Sharmaks--(cherry picked from commit fd93e5387b554a78413bc0f14b729e58fea604ea)-
|
p
|
https://github.com/apache/hadoop
|
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index 5422c0eb26dbd..af6a01509c6dd 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -178,6 +178,9 @@ Release 2.7.0 - UNRELEASED
YARN-2897. CrossOriginFilter needs more log statements (Mit Desai via
jeagles)
+ YARN-3028. Better syntax for replaceLabelsOnNode in RMAdmin CLI
+ (Rohith Sharmaks via wangda)
+
OPTIMIZATIONS
BUG FIXES
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java
index 9ea333cab4cba..6f1bbd09d83bf 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java
@@ -100,7 +100,8 @@ public class RMAdminCLI extends HAAdmin {
new UsageInfo("[label1,label2,label3] (label splitted by \",\")",
"remove from cluster node labels"))
.put("-replaceLabelsOnNode",
- new UsageInfo("[node1:port,label1,label2 node2:port,label1,label2]",
+ new UsageInfo(
+ "[node1[:port]=label1,label2 node2[:port]=label1,label2]",
"replace labels on nodes"))
.put("-directlyAccessNodeLabelStore",
new UsageInfo("", "Directly access node label store, "
@@ -199,7 +200,7 @@ private static void printHelp(String cmd, boolean isHAEnabled) {
" [-getGroup [username]]" +
" [[-addToClusterNodeLabels [label1,label2,label3]]" +
" [-removeFromClusterNodeLabels [label1,label2,label3]]" +
- " [-replaceLabelsOnNode [node1:port,label1,label2 node2:port,label1]" +
+ " [-replaceLabelsOnNode [node1[:port]=label1,label2 node2[:port]=label1]" +
" [-directlyAccessNodeLabelStore]]");
if (isHAEnabled) {
appendHAUsage(summary);
@@ -398,8 +399,18 @@ private Map<NodeId, Set<String>> buildNodeLabelsMapFromStr(String args)
continue;
}
- String[] splits = nodeToLabels.split(",");
+ // "," also supported for compatibility
+ String[] splits = nodeToLabels.split("=");
+ int index = 0;
+ if (splits.length != 2) {
+ splits = nodeToLabels.split(",");
+ index = 1;
+ }
+
String nodeIdStr = splits[0];
+ if (index == 0) {
+ splits = splits[1].split(",");
+ }
if (nodeIdStr.trim().isEmpty()) {
throw new IOException("node name cannot be empty");
@@ -408,7 +419,7 @@ private Map<NodeId, Set<String>> buildNodeLabelsMapFromStr(String args)
NodeId nodeId = ConverterUtils.toNodeIdWithDefaultPort(nodeIdStr);
map.put(nodeId, new HashSet<String>());
- for (int i = 1; i < splits.length; i++) {
+ for (int i = index; i < splits.length; i++) {
if (!splits[i].trim().isEmpty()) {
map.get(nodeId).add(splits[i].trim());
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRMAdminCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRMAdminCLI.java
index 92af27dc692ca..1dfeac21d4425 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRMAdminCLI.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRMAdminCLI.java
@@ -73,7 +73,6 @@ public class TestRMAdminCLI {
@Before
public void configure() throws IOException, YarnException {
remoteAdminServiceAccessed = false;
- dummyNodeLabelsManager = new DummyCommonNodeLabelsManager();
admin = mock(ResourceManagerAdministrationProtocol.class);
when(admin.addToClusterNodeLabels(any(AddToClusterNodeLabelsRequest.class)))
.thenAnswer(new Answer<AddToClusterNodeLabelsResponse>() {
@@ -105,6 +104,7 @@ protected HAServiceTarget resolveTarget(String rmId) {
return haServiceTarget;
}
};
+ initDummyNodeLabelsManager();
rmAdminCLI.localNodeLabelsManager = dummyNodeLabelsManager;
YarnConfiguration conf = new YarnConfiguration();
@@ -124,6 +124,13 @@ protected HAServiceTarget resolveTarget(String rmId) {
};
}
+ private void initDummyNodeLabelsManager() {
+ Configuration conf = new YarnConfiguration();
+ conf.setBoolean(YarnConfiguration.NODE_LABELS_ENABLED, true);
+ dummyNodeLabelsManager = new DummyCommonNodeLabelsManager();
+ dummyNodeLabelsManager.init(conf);
+ }
+
@Test(timeout=500)
public void testRefreshQueues() throws Exception {
String[] args = { "-refreshQueues" };
@@ -281,7 +288,7 @@ public void testHelp() throws Exception {
"[-refreshAdminAcls] [-refreshServiceAcl] [-getGroup" +
" [username]] [[-addToClusterNodeLabels [label1,label2,label3]]" +
" [-removeFromClusterNodeLabels [label1,label2,label3]] [-replaceLabelsOnNode " +
- "[node1:port,label1,label2 node2:port,label1] [-directlyAccessNodeLabelStore]] " +
+ "[node1[:port]=label1,label2 node2[:port]=label1] [-directlyAccessNodeLabelStore]] " +
"[-help [cmd]]"));
assertTrue(dataOut
.toString()
@@ -361,7 +368,7 @@ public void testHelp() throws Exception {
"[-refreshAdminAcls] [-refreshServiceAcl] [-getGroup" +
" [username]] [[-addToClusterNodeLabels [label1,label2,label3]]" +
" [-removeFromClusterNodeLabels [label1,label2,label3]] [-replaceLabelsOnNode " +
- "[node1:port,label1,label2 node2:port,label1] [-directlyAccessNodeLabelStore]] " +
+ "[node1[:port]=label1,label2 node2[:port]=label1] [-directlyAccessNodeLabelStore]] " +
"[-transitionToActive [--forceactive] <serviceId>] " +
"[-transitionToStandby <serviceId>] [-failover" +
" [--forcefence] [--forceactive] <serviceId> <serviceId>] " +
@@ -501,24 +508,29 @@ public void testRemoveFromClusterNodeLabels() throws Exception {
@Test
public void testReplaceLabelsOnNode() throws Exception {
// Successfully replace labels
- dummyNodeLabelsManager.addToCluserNodeLabels(ImmutableSet.of("x", "Y"));
+ dummyNodeLabelsManager
+ .addToCluserNodeLabels(ImmutableSet.of("x", "y", "Y"));
String[] args =
- { "-replaceLabelsOnNode", "node1,x,Y node2,Y",
+ { "-replaceLabelsOnNode",
+ "node1:8000,x,y node2:8000=y node3,x,Y node4=Y",
"-directlyAccessNodeLabelStore" };
assertEquals(0, rmAdminCLI.run(args));
assertTrue(dummyNodeLabelsManager.getNodeLabels().containsKey(
- NodeId.newInstance("node1", 0)));
+ NodeId.newInstance("node1", 8000)));
assertTrue(dummyNodeLabelsManager.getNodeLabels().containsKey(
- NodeId.newInstance("node2", 0)));
-
+ NodeId.newInstance("node2", 8000)));
+ assertTrue(dummyNodeLabelsManager.getNodeLabels().containsKey(
+ NodeId.newInstance("node3", 0)));
+ assertTrue(dummyNodeLabelsManager.getNodeLabels().containsKey(
+ NodeId.newInstance("node4", 0)));
+
// no labels, should fail
args = new String[] { "-replaceLabelsOnNode" };
assertTrue(0 != rmAdminCLI.run(args));
-
+
// no labels, should fail
args =
- new String[] { "-replaceLabelsOnNode",
- "-directlyAccessNodeLabelStore" };
+ new String[] { "-replaceLabelsOnNode", "-directlyAccessNodeLabelStore" };
assertTrue(0 != rmAdminCLI.run(args));
// no labels, should fail
@@ -529,20 +541,6 @@ public void testReplaceLabelsOnNode() throws Exception {
assertTrue(0 != rmAdminCLI.run(args));
}
- @Test
- public void testReplaceLabelsOnNodeWithPort() throws Exception {
- // Successfully replace labels
- dummyNodeLabelsManager.addToCluserNodeLabels(ImmutableSet.of("x", "y"));
- String[] args =
- { "-replaceLabelsOnNode", "node1:8000,x,y node2:8000,y",
- "-directlyAccessNodeLabelStore" };
- assertEquals(0, rmAdminCLI.run(args));
- assertTrue(dummyNodeLabelsManager.getNodeLabels().containsKey(
- NodeId.newInstance("node1", 8000)));
- assertTrue(dummyNodeLabelsManager.getNodeLabels().containsKey(
- NodeId.newInstance("node2", 8000)));
- }
-
private void testError(String[] args, String template,
ByteArrayOutputStream data, int resultCode) throws Exception {
int actualResultCode = rmAdminCLI.run(args);
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/nodelabels/TestCommonNodeLabelsManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/nodelabels/TestCommonNodeLabelsManager.java
index 242f59caf2271..0ab1115491838 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/nodelabels/TestCommonNodeLabelsManager.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/nodelabels/TestCommonNodeLabelsManager.java
@@ -333,23 +333,32 @@ private void assertNodeLabelsDisabledErrorMessage(IOException e) {
public void testNodeLabelsDisabled() throws IOException {
DummyCommonNodeLabelsManager mgr = new DummyCommonNodeLabelsManager();
Configuration conf = new YarnConfiguration();
- conf.setBoolean(YarnConfiguration.NODE_LABELS_ENABLED, true);
+ conf.setBoolean(YarnConfiguration.NODE_LABELS_ENABLED, false);
mgr.init(conf);
mgr.start();
+ boolean caught = false;
// add labels
try {
mgr.addToCluserNodeLabels(ImmutableSet.of("x"));
} catch (IOException e) {
assertNodeLabelsDisabledErrorMessage(e);
+ caught = true;
}
+ // check exception caught
+ Assert.assertTrue(caught);
+ caught = false;
// remove labels
try {
mgr.removeFromClusterNodeLabels(ImmutableSet.of("x"));
} catch (IOException e) {
assertNodeLabelsDisabledErrorMessage(e);
+ caught = true;
}
+ // check exception caught
+ Assert.assertTrue(caught);
+ caught = false;
// add labels to node
try {
@@ -357,7 +366,11 @@ public void testNodeLabelsDisabled() throws IOException {
CommonNodeLabelsManager.EMPTY_STRING_SET));
} catch (IOException e) {
assertNodeLabelsDisabledErrorMessage(e);
+ caught = true;
}
+ // check exception caught
+ Assert.assertTrue(caught);
+ caught = false;
// remove labels from node
try {
@@ -365,7 +378,11 @@ public void testNodeLabelsDisabled() throws IOException {
CommonNodeLabelsManager.EMPTY_STRING_SET));
} catch (IOException e) {
assertNodeLabelsDisabledErrorMessage(e);
+ caught = true;
}
+ // check exception caught
+ Assert.assertTrue(caught);
+ caught = false;
// replace labels on node
try {
@@ -373,7 +390,11 @@ public void testNodeLabelsDisabled() throws IOException {
CommonNodeLabelsManager.EMPTY_STRING_SET));
} catch (IOException e) {
assertNodeLabelsDisabledErrorMessage(e);
+ caught = true;
}
+ // check exception caught
+ Assert.assertTrue(caught);
+ caught = false;
mgr.close();
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.