Commit dfbe9d25 authored by Sheng Wang's avatar Sheng Wang
Browse files

generate id by using Common.buildId

parent 4cea08be
Pipeline #27557 failed with stages
in 9 minutes and 47 seconds
......@@ -19,6 +19,7 @@ import org.opengroup.osdu.wd.core.dataaccess.interfaces.IEntityDBClient;
import org.opengroup.osdu.wd.core.models.EntityDtoReturn;
import org.opengroup.osdu.wd.core.models.EntityDto;
import org.opengroup.osdu.wd.core.models.Relationship;
import org.opengroup.osdu.wd.core.util.Common;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;
......@@ -63,7 +64,7 @@ public class CosmosEntityClient implements IEntityDBClient {
public EntityDtoReturn getSpecificEntityVersion(String entityType, String entityId, long version) {
CosmosContainer container = cosmosInit.getEntityContainer(entityType);
String id = String.format("%s_%s", entityId, version);
String id = Common.buildId(entityId, version);
CosmosEntity res = CosmosdbFacade.findSpecificItem(container, id, entityId);
if (res == null)
return null;
......@@ -98,7 +99,7 @@ public class CosmosEntityClient implements IEntityDBClient {
public long deleteEntityVersion(String entityType, String entityId, long version) {
CosmosContainer container = cosmosInit.getEntityContainer(entityType);
String id = String.format("%s_%s", entityId, version);
String id = Common.buildId(entityId, version);
int cnt = CosmosdbFacade.deleteItem(container, id, entityId);
return cnt;
}
......@@ -107,7 +108,7 @@ public class CosmosEntityClient implements IEntityDBClient {
public long purgeEntityVersion(String entityType, String entityId, long version) {
CosmosContainer container = cosmosInit.getEntityContainer(entityType);
String id = String.format("%s_%s", entityId, version);
String id = Common.buildId(entityId, version);
int cnt = CosmosdbFacade.purgeItem(container, id, entityId);
return cnt;
}
......
......@@ -37,8 +37,8 @@ public class EntityUtil {
}
Assert.assertEquals(HttpStatus.SC_CREATED, response.getStatus());
Thread.sleep(100);
System.out.println(String.format("created entity: %s", id));
long version = getVersion(response, type, id);
System.out.println(String.format("created entity: %s:%d", id, version));
return version;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment