use of io.lumeer.api.model.ResourceVariable in project engine by Lumeer.
the class ResourceVariablesServiceIT method testUpdateVariable.
@Test
public void testUpdateVariable() {
ResourceVariable variable = createVariable("key", "value", false);
variable.setKey("key2");
variable.setValue("vabcdsaddsa");
Entity entity = Entity.json(variable);
Response response = client.target(variablesUrl).path(variable.getId()).request(MediaType.APPLICATION_JSON).buildPut(entity).invoke();
assertThat(response).isNotNull();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
ResourceVariable returnedVariable = response.readEntity(ResourceVariable.class);
assertVariables(variable, returnedVariable, false);
}
use of io.lumeer.api.model.ResourceVariable in project engine by Lumeer.
the class ResourceVariablesServiceIT method testUpdateBadRequestVariable.
@Test
public void testUpdateBadRequestVariable() {
ResourceVariable variable = createVariable("key", "value", false);
variable.setOrganizationId("xyzyzyzz");
Entity entity = Entity.json(variable);
Response response = client.target(variablesUrl).path(variable.getId()).request(MediaType.APPLICATION_JSON).buildPut(entity).invoke();
assertThat(response).isNotNull();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.BAD_REQUEST);
}
use of io.lumeer.api.model.ResourceVariable in project engine by Lumeer.
the class ResourceVariablesServiceIT method testCreateVariable.
@Test
public void testCreateVariable() {
ResourceVariable variable = prepareVariable("key", "value", false);
Entity entity = Entity.json(variable);
Response response = client.target(variablesUrl).request(MediaType.APPLICATION_JSON).buildPost(entity).invoke();
assertThat(response).isNotNull();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
ResourceVariable returnedVariable = response.readEntity(ResourceVariable.class);
assertVariables(variable, returnedVariable, false);
}
use of io.lumeer.api.model.ResourceVariable in project engine by Lumeer.
the class ResourceVariablesServiceIT method testGetSecureVariables.
@Test
public void testGetSecureVariables() {
createVariable("k1", "dsdad", true);
createVariable("k2", "vadaslue", false);
createVariable("k3", "dsa", true);
createVariable("k4", "vadsadsalue", false);
createVariable("k5", "dasdsadsa", true);
Response response = client.target(variablesUrl).path("projects").path(projectId).request(MediaType.APPLICATION_JSON).buildGet().invoke();
assertThat(response).isNotNull();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
List<ResourceVariable> variables = response.readEntity(new GenericType<List<ResourceVariable>>() {
});
variables.forEach(variable -> {
if (variable.getSecure()) {
assertThat(variable.getKey()).isIn("k1", "k3", "k5");
assertThat(variable.getValue()).isNull();
} else {
assertThat(variable.getKey()).isIn("k2", "k4");
assertThat(variable.getValue()).isNotNull();
}
});
}
use of io.lumeer.api.model.ResourceVariable in project engine by Lumeer.
the class ResourceVariablesServiceIT method testGetVariable.
@Test
public void testGetVariable() {
final ResourceVariable variable = createVariable("key", "value", false);
Response response = client.target(variablesUrl).path(variable.getId()).request(MediaType.APPLICATION_JSON).buildGet().invoke();
assertThat(response).isNotNull();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
ResourceVariable returnedVariable = response.readEntity(ResourceVariable.class);
assertVariables(variable, returnedVariable, false);
}
Aggregations