Skip to content

Commit

Permalink
Merge pull request #1457 from iocanel/sundrio-bump
Browse files Browse the repository at this point in the history
  • Loading branch information
fusesource-ci authored Mar 27, 2019
2 parents ad28647 + 59e2e9a commit a2b88d2
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Introduce file and dir read / copy from pods

Dependency Upgrade
* Upgrade Sundrio to 0.16.5
* Upgrade Sundrio to 0.17.0
* Upgrade to Bean Validation 2.0

New Feature
Expand Down
12 changes: 0 additions & 12 deletions kubernetes-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,6 @@
<scope>test</scope>
</dependency>


<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-ext-jdk15on</artifactId>
<version>${bouncycastle.version}</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>${bouncycastle.version}</version>
</dependency>

<dependency>
<groupId>io.fabric8</groupId>
<artifactId>mockwebserver</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import io.fabric8.kubernetes.api.builder.TypedVisitor;
import io.fabric8.kubernetes.api.model.ContainerFluent;
import io.fabric8.openshift.api.model.DeploymentConfigSpecFluent;
import org.junit.Rule;
import org.junit.Test;

Expand All @@ -31,6 +34,8 @@
import io.fabric8.openshift.api.model.DeploymentConfigListBuilder;
import io.fabric8.openshift.client.OpenShiftClient;

import java.util.concurrent.atomic.AtomicBoolean;

public class DeploymentConfigTest {
@Rule
public OpenShiftServer server = new OpenShiftServer();
Expand Down Expand Up @@ -180,4 +185,59 @@ public void testDeployingLatestHandlesMissingLatestVersion() {
assertNotNull(deploymentConfig);
assertEquals(new Long(1), deploymentConfig.getStatus().getLatestVersion());
}

//This is a test that verifies a recent fix (sundrio #135).
//According to this issue when editing a list of buildables using predicates, the object visitors get overwrriten.
@Test
public void testDeploymentConfigVisitor() {
AtomicBoolean visitedContainer = new AtomicBoolean();

DeploymentConfig dc1 = new DeploymentConfigBuilder()
.withNewMetadata()
.withName("dc1")
.endMetadata()
.withNewSpec()
.withReplicas(1)
.addToSelector("name", "dc1")
.addNewTrigger()
.withType("ImageChange")
.withNewImageChangeParams()
.withAutomatic(true)
.withContainerNames("container")
.withNewFrom()
.withKind("ImageStreamTag")
.withName("image:1.0")
.endFrom()
.endImageChangeParams()
.endTrigger()
.withNewTemplate()
.withNewSpec()
.addNewContainer()
.withName("container")
.withImage("image")
.endContainer()
.endSpec()
.endTemplate()
.endSpec()
.build();

DeploymentConfig dc2 = new DeploymentConfigBuilder(dc1)
.accept(new TypedVisitor<DeploymentConfigSpecFluent<?>>() {
@Override
public void visit(DeploymentConfigSpecFluent<?> spec) {
spec.editMatchingTrigger(b -> b.buildImageChangeParams().getContainerNames().contains("container"))
.withType("ImageChange")
.endTrigger();
}
})
.accept(new TypedVisitor<ContainerFluent<?>>() {
@Override
public void visit(ContainerFluent<?> container) {
container.addNewEnv().withName("FOO").withValue("BAR").endEnv();
visitedContainer.set(true);

}
}).build();
assertTrue(visitedContainer.get());
}
}
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<commons-codec.version>1.10</commons-codec.version>
<commons-compress.version>1.9</commons-compress.version>
<scr.annotations.version>1.9.12</scr.annotations.version>
<sundrio.version>0.14.6</sundrio.version>
<sundrio.version>0.17.0</sundrio.version>
<validation.api.version>1.1.0.Final</validation.api.version>
<maven.bundle.plugin.version>2.5.4</maven.bundle.plugin.version>
<maven.buildhelper.plugin.version>1.10</maven.buildhelper.plugin.version>
Expand All @@ -115,7 +115,6 @@
<maven.surefire.plugin.version>3.0.0-M1</maven.surefire.plugin.version>
<maven.scr.plugin.version>1.22.0</maven.scr.plugin.version>
<scr.annotations.version>1.12.0</scr.annotations.version>
<sundrio.version>0.16.5</sundrio.version>
<validation.api.version>2.0.1.Final</validation.api.version>
<maven.bundle.plugin.version>4.1.0</maven.bundle.plugin.version>
<maven.buildhelper.plugin.version>3.0.0</maven.buildhelper.plugin.version>
Expand Down

0 comments on commit a2b88d2

Please sign in to comment.