use of io.fabric8.maven.docker.config.CopyConfiguration.Entry in project docker-maven-plugin by fabric8io.
the class CopyConfigurationTest method assertEntriesAsProperties.
private void assertEntriesAsProperties(final CopyConfiguration cfg, Collection<Entry> expected) {
final List<Properties> actual = cfg.getEntriesAsListOfProperties();
if (expected == null) {
assertNull(actual);
return;
}
assertNotNull(actual);
assertEquals(expected.size(), actual.size());
final Iterator<Properties> actualIterator = actual.iterator();
for (Entry expectedEntry : expected) {
final Properties actualEntry = actualIterator.next();
assertEquals(expectedEntry.getContainerPath(), actualEntry.get(CONTAINER_PATH_PROPERTY));
assertEquals(expectedEntry.getHostDirectory(), actualEntry.get(HOST_DIRECTORY_PROPERTY));
}
}
use of io.fabric8.maven.docker.config.CopyConfiguration.Entry in project docker-maven-plugin by fabric8io.
the class CopyConfigurationTest method entriesAsListOfProperties.
private List<Properties> entriesAsListOfProperties(Collection<Entry> expected) {
if (expected == null) {
return null;
}
final List<Properties> propertiesList = new ArrayList<>(expected.size());
for (Entry entry : expected) {
final Properties properties = new Properties();
final String containerPath = entry.getContainerPath();
final String hostDirectory = entry.getHostDirectory();
if (containerPath != null && hostDirectory == null) {
properties.put("", containerPath);
} else {
if (containerPath != null) {
properties.put(CONTAINER_PATH_PROPERTY, containerPath);
}
if (hostDirectory != null) {
properties.put(HOST_DIRECTORY_PROPERTY, hostDirectory);
}
}
properties.put("some.garbage", "which should be ignored");
propertiesList.add(properties);
}
return propertiesList;
}
use of io.fabric8.maven.docker.config.CopyConfiguration.Entry in project docker-maven-plugin by fabric8io.
the class CopyConfigurationTest method copyOfNotNull.
@Test
public void copyOfNotNull() {
final List<Entry> expected = entries();
final CopyConfiguration original = new Builder().entries(expected).build();
final CopyConfiguration copy = new Builder(original).build();
assertEntries(copy, expected);
assertEntriesAsProperties(copy, expected);
}
use of io.fabric8.maven.docker.config.CopyConfiguration.Entry in project docker-maven-plugin by fabric8io.
the class CopyConfigurationTest method entryGetters.
@Test
public void entryGetters() {
final String containerPath = "container";
final String hostDirectory = "host";
final Entry entry = new Entry(containerPath, hostDirectory);
assertEquals(containerPath, entry.getContainerPath());
assertEquals(hostDirectory, entry.getHostDirectory());
}
use of io.fabric8.maven.docker.config.CopyConfiguration.Entry in project syndesis-qe by syndesisio.
the class Syndesis method updateAddon.
/**
* Enable or disable the addon
*
* @param addon - which type of addon
* @param enabled - enable or disable?
* @param properties - additional properties for the specific addon
*/
public void updateAddon(Addon addon, boolean enabled, Map<String, Object> properties) {
log.info((enabled ? "Enabling " : "Disabling ") + addon + " addon.");
JSONObject cr = new JSONObject(getCr());
JSONObject specAddon = cr.getJSONObject("spec").getJSONObject("addons").getJSONObject(addon.getValue());
specAddon.put("enabled", enabled);
if (properties != null) {
for (Map.Entry<String, Object> entry : properties.entrySet()) {
log.info("Adding property '" + entry.getKey() + ": " + entry.getValue() + "' for addon " + addon.getValue() + " to the CR");
specAddon.put(entry.getKey(), entry.getValue());
}
}
try {
this.editCr(cr.toMap());
} catch (KubernetesClientException kce) {
if (kce.getMessage().contains("the object has been modified")) {
log.warn("CR was modified in the mean time, retrying in 30 seconds");
TestUtils.sleepIgnoreInterrupt(30000L);
updateAddon(addon, enabled, properties);
} else {
throw kce;
}
}
}
Aggregations