Skip to content

Image id changed from integer to string #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions src/main/java/com/myjeeva/digitalocean/pojo/Image.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
*/
package com.myjeeva.digitalocean.pojo;

import java.util.Date;
import java.util.List;

import org.apache.commons.lang3.builder.ReflectionToStringBuilder;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.myjeeva.digitalocean.common.ImageStatus;
import com.myjeeva.digitalocean.common.ImageType;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;

/**
* Represents Droplet Image (also public images aka Distribution) attributes of DigitalOcean
Expand All @@ -38,7 +40,7 @@ public class Image extends Base {

private static final long serialVersionUID = 1321111459154107563L;

private Integer id;
private String id;

@Expose private String name;

Expand Down Expand Up @@ -82,14 +84,10 @@ public Image() {
// Default constructor
}

public Image(Integer id) {
public Image(String id) {
this.id = id;
}

public Image(String slug) {
this.slug = slug;
}

public Image(String name, String url, String region) {
this.name = name;
this.url = url;
Expand All @@ -112,12 +110,12 @@ public boolean isBackup() {
}

/** @return the id */
public Integer getId() {
public String getId() {
return id;
}

/** @param id the id to set */
public void setId(Integer id) {
public void setId(String id) {
this.id = id;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.myjeeva.digitalocean.common.ActionType;
import com.myjeeva.digitalocean.common.Environment;
import com.myjeeva.digitalocean.common.LoadBalancingAlgorithm;
Expand Down Expand Up @@ -70,15 +81,6 @@
import com.myjeeva.digitalocean.pojo.Tag;
import com.myjeeva.digitalocean.pojo.Volume;
import com.myjeeva.digitalocean.pojo.Volumes;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Junit Integration Test case for DigitalOcean API client wrapper methods
Expand Down Expand Up @@ -110,6 +112,9 @@ public class DigitalOceanIntegrationTest {
private final String firewallIdForInfo =
"190ceeb7-779a-4b04-9091-4dd175de65ec"; // to be placed before use

private final String imageIdForDropletCreation = "1601"; // to be placed before use. Same is used for updating the
// image info

private final String domainName = "";

private String projectId;
Expand Down Expand Up @@ -175,7 +180,7 @@ public void testCreateDropletByImageId()
Droplet droplet = new Droplet();
droplet.setName("api-client-test-host-byid");
droplet.setSize("512mb");
droplet.setImage(new Image(1601));
droplet.setImage(new Image(imageIdForDropletCreation));
droplet.setRegion(new Region("sgp1"));
droplet.setEnableBackup(Boolean.TRUE);
droplet.setEnableIpv6(Boolean.TRUE);
Expand Down Expand Up @@ -574,7 +579,7 @@ public void testCreateCustomImage() throws DigitalOceanException, RequestUnsucce
public void testUpdateImageInfo() throws DigitalOceanException, RequestUnsuccessfulException {

Image input = new Image();
input.setId(3897539);
input.setId(imageIdForDropletCreation);
input.setName("test-myjeeva.com-before-wp-upgrade");
Image image = apiClient.updateImage(input);

Expand Down