Add missing index on tag.name (#660)

* Add missing tag name filter for RSQL queries.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Add schabdo as commiter.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* DDI API rename and add test.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Remove unneeded text.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Add missing auto close.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2018-03-19 11:31:26 +01:00
committed by GitHub
parent a8cd650375
commit a55c34d0bb
12 changed files with 47 additions and 33 deletions

View File

@@ -9,6 +9,7 @@
package org.eclipse.hawkbit.mgmt.rest.resource;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import java.util.List;
@@ -79,8 +80,8 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi {
fileName = file.getOriginalFilename();
}
try {
final Artifact result = artifactManagement.create(file.getInputStream(), softwareModuleId, fileName,
try (InputStream in = file.getInputStream()) {
final Artifact result = artifactManagement.create(in, softwareModuleId, fileName,
md5Sum == null ? null : md5Sum.toLowerCase(), sha1Sum == null ? null : sha1Sum.toLowerCase(), false,
file.getContentType());

View File

@@ -48,7 +48,6 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.repository.test.util.AbstractIntegrationTest;
import org.eclipse.hawkbit.repository.test.util.WithUser;
import org.eclipse.hawkbit.rest.exception.MessageNotReadableException;
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
@@ -60,10 +59,10 @@ import org.junit.Test;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Slice;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.hateoas.MediaTypes;
import com.jayway.jsonpath.JsonPath;
@@ -1227,9 +1226,8 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
final Target target = testdataFactory.createTarget("fsdfsd");
final DistributionSet set = testdataFactory.createDistributionSet("one");
final String body = new JSONObject().put("id", set.getId()).put("type", "forced").put("maintenanceWindow",
AbstractIntegrationTest.getMaintenanceWindow(AbstractIntegrationTest.getTestSchedule(0), "", ""))
.toString();
final String body = new JSONObject().put("id", set.getId()).put("type", "forced")
.put("maintenanceWindow", getMaintenanceWindow(getTestSchedule(0), "", "")).toString();
mvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/" + target.getControllerId() + "/assignedDS")
.content(body).contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
@@ -1243,9 +1241,8 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
final Target target = testdataFactory.createTarget("fsdfsd");
final DistributionSet set = testdataFactory.createDistributionSet("one");
final String body = new JSONObject().put("id", set.getId()).put("type", "forced").put("maintenanceWindow",
AbstractIntegrationTest.getMaintenanceWindow("", AbstractIntegrationTest.getTestDuration(10), ""))
.toString();
final String body = new JSONObject().put("id", set.getId()).put("type", "forced")
.put("maintenanceWindow", getMaintenanceWindow("", getTestDuration(10), "")).toString();
mvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/" + target.getControllerId() + "/assignedDS")
.content(body).contentType(MediaTypes.HAL_JSON_VALUE)).andDo(MockMvcResultPrinter.print())
@@ -1261,8 +1258,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
final String body = new JSONObject().put("id", set.getId()).put("type", "forced").put("forcetime", "0")
.put("maintenanceWindow",
AbstractIntegrationTest.getMaintenanceWindow(AbstractIntegrationTest.getTestSchedule(10),
AbstractIntegrationTest.getTestDuration(10), AbstractIntegrationTest.getTestTimeZone()))
getMaintenanceWindow(getTestSchedule(10), getTestDuration(10), getTestTimeZone()))
.toString();
mvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/" + target.getControllerId() + "/assignedDS")
@@ -1277,11 +1273,8 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
final Target target = testdataFactory.createTarget("fsdfsd");
final DistributionSet set = testdataFactory.createDistributionSet("one");
final String body = new JSONObject().put("id", set.getId()).put("type", "forced")
.put("maintenanceWindow",
AbstractIntegrationTest.getMaintenanceWindow(AbstractIntegrationTest.getTestSchedule(-30),
AbstractIntegrationTest.getTestDuration(5), AbstractIntegrationTest.getTestTimeZone()))
.toString();
final String body = new JSONObject().put("id", set.getId()).put("type", "forced").put("maintenanceWindow",
getMaintenanceWindow(getTestSchedule(-30), getTestDuration(5), getTestTimeZone())).toString();
mvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/" + target.getControllerId() + "/assignedDS")
.content(body).contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())