@@ -26,6 +26,113 @@ public void parseUsingDefaultAccessMode() { |
26 | 26 | assertThat(bind.getPropagationMode(), is(PropagationMode.DEFAULT_MODE)); |
27 | 27 | } |
28 | 28 |
|
| 29 | + @Test |
| 30 | + public void parseReadWriteWindows() { |
| 31 | + Bind bind = Bind.parse("C:\\host:/container:rw"); |
| 32 | + assertThat(bind.getPath(), is("C:\\host")); |
| 33 | + assertThat(bind.getVolume().getPath(), is("/container")); |
| 34 | + assertThat(bind.getAccessMode(), is(rw)); |
| 35 | + assertThat(bind.getSecMode(), is(SELContext.none)); |
| 36 | + assertThat(bind.getNoCopy(), nullValue()); |
| 37 | + assertThat(bind.getPropagationMode(), is(PropagationMode.DEFAULT_MODE)); |
| 38 | + } |
| 39 | + |
| 40 | + @Test |
| 41 | + public void parseReadWriteNoCopyWindows() { |
| 42 | + Bind bind = Bind.parse("C:\\host:/container:rw,nocopy"); |
| 43 | + assertThat(bind.getPath(), is("C:\\host")); |
| 44 | + assertThat(bind.getVolume().getPath(), is("/container")); |
| 45 | + assertThat(bind.getAccessMode(), is(rw)); |
| 46 | + assertThat(bind.getSecMode(), is(SELContext.none)); |
| 47 | + assertThat(bind.getNoCopy(), is(true)); |
| 48 | + assertThat(bind.getPropagationMode(), is(PropagationMode.DEFAULT_MODE)); |
| 49 | + } |
| 50 | + |
| 51 | + @Test |
| 52 | + public void parseReadWriteSharedWindows() { |
| 53 | + Bind bind = Bind.parse("C:\\host:/container:rw,shared"); |
| 54 | + assertThat(bind.getPath(), is("C:\\host")); |
| 55 | + assertThat(bind.getVolume().getPath(), is("/container")); |
| 56 | + assertThat(bind.getAccessMode(), is(rw)); |
| 57 | + assertThat(bind.getSecMode(), is(SELContext.none)); |
| 58 | + assertThat(bind.getNoCopy(), nullValue()); |
| 59 | + assertThat(bind.getPropagationMode(), is(PropagationMode.SHARED)); |
| 60 | + } |
| 61 | + |
| 62 | + @Test |
| 63 | + public void parseReadWriteSlaveWindows() { |
| 64 | + Bind bind = Bind.parse("C:\\host:/container:rw,slave"); |
| 65 | + assertThat(bind.getPath(), is("C:\\host")); |
| 66 | + assertThat(bind.getVolume().getPath(), is("/container")); |
| 67 | + assertThat(bind.getAccessMode(), is(rw)); |
| 68 | + assertThat(bind.getSecMode(), is(SELContext.none)); |
| 69 | + assertThat(bind.getNoCopy(), nullValue()); |
| 70 | + assertThat(bind.getPropagationMode(), is(PropagationMode.SLAVE)); |
| 71 | + } |
| 72 | + |
| 73 | + @Test |
| 74 | + public void parseReadWritePrivateWindows() { |
| 75 | + Bind bind = Bind.parse("C:\\host:/container:rw,private"); |
| 76 | + assertThat(bind.getPath(), is("C:\\host")); |
| 77 | + assertThat(bind.getVolume().getPath(), is("/container")); |
| 78 | + assertThat(bind.getAccessMode(), is(rw)); |
| 79 | + assertThat(bind.getSecMode(), is(SELContext.none)); |
| 80 | + assertThat(bind.getNoCopy(), nullValue()); |
| 81 | + assertThat(bind.getPropagationMode(), is(PropagationMode.PRIVATE)); |
| 82 | + } |
| 83 | + |
| 84 | + @Test |
| 85 | + public void parseReadOnlyWindows() { |
| 86 | + Bind bind = Bind.parse("C:\\host:/container:ro"); |
| 87 | + assertThat(bind.getPath(), is("C:\\host")); |
| 88 | + assertThat(bind.getVolume().getPath(), is("/container")); |
| 89 | + assertThat(bind.getAccessMode(), is(ro)); |
| 90 | + assertThat(bind.getSecMode(), is(SELContext.none)); |
| 91 | + assertThat(bind.getNoCopy(), nullValue()); |
| 92 | + assertThat(bind.getPropagationMode(), is(PropagationMode.DEFAULT_MODE)); |
| 93 | + } |
| 94 | + |
| 95 | + @Test |
| 96 | + public void parseSELOnlyWindows() { |
| 97 | + Bind bind = Bind.parse("C:\\host:/container:Z"); |
| 98 | + assertThat(bind.getPath(), is("C:\\host")); |
| 99 | + assertThat(bind.getVolume().getPath(), is("/container")); |
| 100 | + assertThat(bind.getAccessMode(), is(AccessMode.DEFAULT)); |
| 101 | + assertThat(bind.getSecMode(), is(SELContext.single)); |
| 102 | + assertThat(bind.getNoCopy(), nullValue()); |
| 103 | + assertThat(bind.getPropagationMode(), is(PropagationMode.DEFAULT_MODE)); |
| 104 | + |
| 105 | + bind = Bind.parse("C:\\host:/container:z"); |
| 106 | + assertThat(bind.getPath(), is("C:\\host")); |
| 107 | + assertThat(bind.getVolume().getPath(), is("/container")); |
| 108 | + assertThat(bind.getAccessMode(), is(AccessMode.DEFAULT)); |
| 109 | + assertThat(bind.getSecMode(), is(SELContext.shared)); |
| 110 | + assertThat(bind.getNoCopy(), nullValue()); |
| 111 | + assertThat(bind.getPropagationMode(), is(PropagationMode.DEFAULT_MODE)); |
| 112 | + } |
| 113 | + |
| 114 | + @Test |
| 115 | + public void parseReadWriteSELWindows() { |
| 116 | + Bind bind = Bind.parse("C:\\host:/container:rw,Z"); |
| 117 | + assertThat(bind.getPath(), is("C:\\host")); |
| 118 | + assertThat(bind.getVolume().getPath(), is("/container")); |
| 119 | + assertThat(bind.getAccessMode(), is(rw)); |
| 120 | + assertThat(bind.getSecMode(), is(SELContext.single)); |
| 121 | + assertThat(bind.getNoCopy(), nullValue()); |
| 122 | + assertThat(bind.getPropagationMode(), is(PropagationMode.DEFAULT_MODE)); |
| 123 | + } |
| 124 | + |
| 125 | + @Test |
| 126 | + public void parseReadOnlySELWindows() { |
| 127 | + Bind bind = Bind.parse("C:\\host:/container:ro,z"); |
| 128 | + assertThat(bind.getPath(), is("C:\\host")); |
| 129 | + assertThat(bind.getVolume().getPath(), is("/container")); |
| 130 | + assertThat(bind.getAccessMode(), is(ro)); |
| 131 | + assertThat(bind.getSecMode(), is(SELContext.shared)); |
| 132 | + assertThat(bind.getNoCopy(), nullValue()); |
| 133 | + assertThat(bind.getPropagationMode(), is(PropagationMode.DEFAULT_MODE)); |
| 134 | + } |
| 135 | + |
29 | 136 | @Test |
30 | 137 | public void parseReadWrite() { |
31 | 138 | Bind bind = Bind.parse("/host:/container:rw"); |
|