@Test public void testNoEnrichment() { KubernetesListBuilder builder = new KubernetesListBuilder() .addNewJobItem() .withNewMetadata() .addToAnnotations("dummy", "annotation") .endMetadata() .withNewSpec() .withNewTemplate() .withNewSpec() .withContainers(createContainers( "c1", "is1:latest", "c2", "is2:latest" )) .endSpec() .endTemplate() .endSpec() .endJobItem(); TriggersAnnotationEnricher enricher = new TriggersAnnotationEnricher(context); enricher.enrich(PlatformMode.kubernetes, builder); Job res = (Job) builder.build().getItems().get(0); String triggers = res.getMetadata().getAnnotations().get("image.openshift.io/triggers"); assertNull(triggers); }
@Override public void enrich(PlatformMode platformMode, KubernetesListBuilder builder) { builder.accept(new TypedVisitor<StatefulSetBuilder>() { @Override public void visit(StatefulSetBuilder o) { StatefulSet s = o.build(); if (canWriteTriggers(s)) { o.withMetadata(getMetaEnrichedWithTriggers(s.getMetadata(), o)); } } }); builder.accept(new TypedVisitor<ReplicaSetBuilder>() { @Override public void visit(ReplicaSetBuilder o) { ReplicaSet s = o.build(); if (canWriteTriggers(s)) { o.withMetadata(getMetaEnrichedWithTriggers(s.getMetadata(), o)); } } }); builder.accept(new TypedVisitor<DaemonSetBuilder>() { @Override public void visit(DaemonSetBuilder o) { DaemonSet s = o.build(); if (canWriteTriggers(s)) { o.withMetadata(getMetaEnrichedWithTriggers(s.getMetadata(), o)); } } }); }
TriggersAnnotationEnricher extends BaseEnricher { @Override public void enrich(PlatformMode platformMode, KubernetesListBuilder builder) { builder.accept(new TypedVisitor<StatefulSetBuilder>() { @Override public void visit(StatefulSetBuilder o) { StatefulSet s = o.build(); if (canWriteTriggers(s)) { o.withMetadata(getMetaEnrichedWithTriggers(s.getMetadata(), o)); } } }); builder.accept(new TypedVisitor<ReplicaSetBuilder>() { @Override public void visit(ReplicaSetBuilder o) { ReplicaSet s = o.build(); if (canWriteTriggers(s)) { o.withMetadata(getMetaEnrichedWithTriggers(s.getMetadata(), o)); } } }); builder.accept(new TypedVisitor<DaemonSetBuilder>() { @Override public void visit(DaemonSetBuilder o) { DaemonSet s = o.build(); if (canWriteTriggers(s)) { o.withMetadata(getMetaEnrichedWithTriggers(s.getMetadata(), o)); } } }); } }
TriggersAnnotationEnricher extends BaseEnricher { @Override public void enrich(PlatformMode platformMode, KubernetesListBuilder builder) { builder.accept(new TypedVisitor<StatefulSetBuilder>() { @Override public void visit(StatefulSetBuilder o) { StatefulSet s = o.build(); if (canWriteTriggers(s)) { o.withMetadata(getMetaEnrichedWithTriggers(s.getMetadata(), o)); } } }); builder.accept(new TypedVisitor<ReplicaSetBuilder>() { @Override public void visit(ReplicaSetBuilder o) { ReplicaSet s = o.build(); if (canWriteTriggers(s)) { o.withMetadata(getMetaEnrichedWithTriggers(s.getMetadata(), o)); } } }); builder.accept(new TypedVisitor<DaemonSetBuilder>() { @Override public void visit(DaemonSetBuilder o) { DaemonSet s = o.build(); if (canWriteTriggers(s)) { o.withMetadata(getMetaEnrichedWithTriggers(s.getMetadata(), o)); } } }); } TriggersAnnotationEnricher(MavenEnricherContext buildContext); }
TriggersAnnotationEnricher extends BaseEnricher { @Override public void enrich(PlatformMode platformMode, KubernetesListBuilder builder) { builder.accept(new TypedVisitor<StatefulSetBuilder>() { @Override public void visit(StatefulSetBuilder o) { StatefulSet s = o.build(); if (canWriteTriggers(s)) { o.withMetadata(getMetaEnrichedWithTriggers(s.getMetadata(), o)); } } }); builder.accept(new TypedVisitor<ReplicaSetBuilder>() { @Override public void visit(ReplicaSetBuilder o) { ReplicaSet s = o.build(); if (canWriteTriggers(s)) { o.withMetadata(getMetaEnrichedWithTriggers(s.getMetadata(), o)); } } }); builder.accept(new TypedVisitor<DaemonSetBuilder>() { @Override public void visit(DaemonSetBuilder o) { DaemonSet s = o.build(); if (canWriteTriggers(s)) { o.withMetadata(getMetaEnrichedWithTriggers(s.getMetadata(), o)); } } }); } TriggersAnnotationEnricher(MavenEnricherContext buildContext); @Override void enrich(PlatformMode platformMode, KubernetesListBuilder builder); }
TriggersAnnotationEnricher extends BaseEnricher { @Override public void enrich(PlatformMode platformMode, KubernetesListBuilder builder) { builder.accept(new TypedVisitor<StatefulSetBuilder>() { @Override public void visit(StatefulSetBuilder o) { StatefulSet s = o.build(); if (canWriteTriggers(s)) { o.withMetadata(getMetaEnrichedWithTriggers(s.getMetadata(), o)); } } }); builder.accept(new TypedVisitor<ReplicaSetBuilder>() { @Override public void visit(ReplicaSetBuilder o) { ReplicaSet s = o.build(); if (canWriteTriggers(s)) { o.withMetadata(getMetaEnrichedWithTriggers(s.getMetadata(), o)); } } }); builder.accept(new TypedVisitor<DaemonSetBuilder>() { @Override public void visit(DaemonSetBuilder o) { DaemonSet s = o.build(); if (canWriteTriggers(s)) { o.withMetadata(getMetaEnrichedWithTriggers(s.getMetadata(), o)); } } }); } TriggersAnnotationEnricher(MavenEnricherContext buildContext); @Override void enrich(PlatformMode platformMode, KubernetesListBuilder builder);  }