-
Notifications
You must be signed in to change notification settings - Fork 642
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#513 : Removed listContainers() and list containers only for API <1.23
For an API >= 1.23 /containers/ listing with an `ancestor` filter can be used to the the image for a container (which is required mostly only for stopping containers in an external call). For API < 1.23 there is still a call to /containers/ with a limit.
- Loading branch information
Showing
8 changed files
with
132 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package io.fabric8.maven.docker; | ||
/* | ||
* | ||
* Copyright 2016 Roland Huss | ||
* | ||
* Licensed 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. | ||
*/ | ||
|
||
import java.io.UnsupportedEncodingException; | ||
import java.net.*; | ||
|
||
import io.fabric8.maven.docker.access.UrlBuilder; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* @author roland | ||
* @since 13/07/16 | ||
*/ | ||
public class UrlBuilderTest { | ||
|
||
@Test | ||
public void listContainers() throws MalformedURLException, UnsupportedEncodingException { | ||
UrlBuilder builder = new UrlBuilder("","1.0"); | ||
|
||
assertEquals("/1.0/containers/json?limit=100",builder.listContainers(100)); | ||
assertEquals("/1.0/containers/json",builder.listContainers(0)); | ||
assertEquals("/1.0/containers/json?filters=" + URLEncoder.encode("{\"ancestor\":[\"nginx\"]}","UTF8"), | ||
builder.listContainers(0, "ancestor", "nginx")); | ||
assertEquals("/1.0/containers/json?limit=10&filters=" + URLEncoder.encode("{\"ancestor\":[\"nginx\"]}","UTF8"), | ||
builder.listContainers(10, "ancestor", "nginx")); | ||
|
||
try { | ||
builder.listContainers(10,"ancestor"); | ||
fail(); | ||
} catch (IllegalArgumentException exp) { | ||
assertTrue(exp.getMessage().contains("pair")); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters