Skip to content

Commit

Permalink
#168 Execs entrypoint iterable of Exec
Browse files Browse the repository at this point in the history
  • Loading branch information
amihaiemil committed Apr 16, 2020
1 parent f830059 commit f12e3f2
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/amihaiemil/docker/Docker.java
Expand Up @@ -81,9 +81,9 @@ Reader events()

/**
* Entry point for the Exec API.
* @return Exec.
* @return Execs.
*/
Exec exec();
Execs execs();

/**
* Entry point for the Swarm API.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/amihaiemil/docker/Exec.java
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2018-2019, Mihai Emil Andronache
* Copyright (c) 2018-2020, Mihai Emil Andronache
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand All @@ -26,7 +26,7 @@
package com.amihaiemil.docker;

/**
* Exec API.
* Exec containing the commands to be run within a Container.
* @author Mihai Andronache (amihaiemil@gmail.com)
* @version $Id$
* @since 0.0.1
Expand Down
36 changes: 36 additions & 0 deletions src/main/java/com/amihaiemil/docker/Execs.java
@@ -0,0 +1,36 @@
/**
* Copyright (c) 2018-2020, Mihai Emil Andronache
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1)Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2)Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3)Neither the name of docker-java-api nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package com.amihaiemil.docker;

/**
* The Exec API. More about it here:<br>
* https://docs.docker.com/engine/api/v1.40/#tag/Exec
* @author Mihai Andronache (amihaiemil@gmail.com)
* @version $Id$
* @since 0.0.12
*/
public interface Execs extends Iterable<Exec> {
}
2 changes: 1 addition & 1 deletion src/main/java/com/amihaiemil/docker/RtDocker.java
Expand Up @@ -122,7 +122,7 @@ public final Volumes volumes() {
}

@Override
public final Exec exec() {
public final Execs execs() {
throw new UnsupportedOperationException(
"Exec API is not yet implemented. If you can contribute please,"
+ " do it here: https://www.github.com/amihaiemil/docker-java-api"
Expand Down
Expand Up @@ -176,7 +176,7 @@ public void returnsNetworks() {
public void unsupportedOperationExec() {
new LocalDocker(
new File("/var/run/docker.sock")
).exec();
).execs();
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/test/java/com/amihaiemil/docker/UnixDockerTestCase.java
Expand Up @@ -175,8 +175,9 @@ public void returnsNetworks() {
@Test(expected = UnsupportedOperationException.class)
public void unsupportedOperationExec() {
new UnixDocker(
new File("/var/run/docker.sock")
).exec();
new File(
"/var/run/docker.sock")
).execs();
}

/**
Expand Down

0 comments on commit f12e3f2

Please sign in to comment.