Skip to content
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

Bugfix/set charging profile request #80

Merged
merged 2 commits into from
Sep 14, 2018
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ public void sendSendLocalListRequest(int listVersion, UpdateType updateType) thr
send(request);
}

public void sendSetChargingProfileRequest(Integer connectorId, ChargingProfile chargingProfile) throws Exception {
SetChargingProfileRequest request = new SetChargingProfileRequest(connectorId, chargingProfile);
public void sendSetChargingProfileRequest(Integer connectorId, ChargingProfile csChargingProfiles) throws Exception {
SetChargingProfileRequest request = new SetChargingProfileRequest(connectorId, csChargingProfiles);
send(request);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public Confirmation handleRequest(UUID sessionIndex, Request request) {
public SetChargingProfileRequest createSetChargingProfileRequest(int connectorId, ChargingProfile profile) {
SetChargingProfileRequest request = new SetChargingProfileRequest();
request.setConnectorId(connectorId);
request.setChargingProfile(profile);
request.setCsChargingProfiles(profile);
return request;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
@XmlRootElement
public class SetChargingProfileRequest implements Request {
private Integer connectorId;
private ChargingProfile chargingProfile;
private ChargingProfile csChargingProfiles;

public SetChargingProfileRequest() {
}

public SetChargingProfileRequest(Integer connectorId, ChargingProfile chargingProfile) {
public SetChargingProfileRequest(Integer connectorId, ChargingProfile csChargingProfiles) {
this.connectorId = connectorId;
this.chargingProfile = chargingProfile;
this.csChargingProfiles = csChargingProfiles;
}

/**
Expand Down Expand Up @@ -77,19 +77,19 @@ public void setConnectorId(Integer connectorId) {
*
* @return the {@link ChargingProfile}.
*/
public ChargingProfile getChargingProfile() {
return chargingProfile;
public ChargingProfile getCsChargingProfiles() {
return csChargingProfiles;
}

/**
* Optional. Charging Profile to be used by the Charge Point for the requested transaction.
* {@link ChargingProfile#setChargingProfilePurpose(ChargingProfilePurposeType)} MUST be set to TxProfile.
*
* @param chargingProfile the {@link ChargingProfile}.
* @param csChargingProfiles the {@link ChargingProfile}.
*/
@XmlElement(name = "csChargingProfiles")
public void setChargingProfile(ChargingProfile chargingProfile) {
this.chargingProfile = chargingProfile;
public void setCsChargingProfiles(ChargingProfile csChargingProfiles) {
this.csChargingProfiles = csChargingProfiles;
}

@Override
Expand All @@ -101,8 +101,8 @@ public boolean transactionRelated() {
public boolean validate() {
boolean valid = connectorId != null && connectorId > 0;

if (chargingProfile != null) {
valid &= chargingProfile.validate();
if (csChargingProfiles != null) {
valid &= csChargingProfiles.validate();
}

return valid;
Expand All @@ -115,19 +115,19 @@ public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
SetChargingProfileRequest that = (SetChargingProfileRequest) o;
return Objects.equals(connectorId, that.connectorId) &&
Objects.equals(chargingProfile, that.chargingProfile);
Objects.equals(csChargingProfiles, that.csChargingProfiles);
}

@Override
public int hashCode() {
return Objects.hash(connectorId, chargingProfile);
return Objects.hash(connectorId, csChargingProfiles);
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("connectorId", connectorId)
.add("chargingProfile", chargingProfile)
.add("csChargingProfiles", csChargingProfiles)
.add("isValid", validate())
.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void createSetChargingProfileRequest_returnsValidSetChargingProfileReques
assertThat(result.validate(), is(true));
assertThat(result.getConnectorId(), is(connectorId));

ChargingProfile resultProfile = result.getChargingProfile();
ChargingProfile resultProfile = result.getCsChargingProfiles();
assertThat(profile, is(resultProfile));

}
Expand Down