several fixes
This commit is contained in:
parent
66b77f5737
commit
c4edad2651
6 changed files with 143 additions and 32 deletions
|
@ -141,8 +141,8 @@ public final class API {
|
||||||
|
|
||||||
public static final String TEMPLATE_ATTRIBUTE_ENDPOINT = "/template-attribute";
|
public static final String TEMPLATE_ATTRIBUTE_ENDPOINT = "/template-attribute";
|
||||||
public static final String TEMPLATE_ATTRIBUTE_RESET_VALUES = "/reset";
|
public static final String TEMPLATE_ATTRIBUTE_RESET_VALUES = "/reset";
|
||||||
public static final String TEMPLATE_ATTRIBUTE_REMOVE_ORIENTATION = "remove-orientation";
|
public static final String TEMPLATE_ATTRIBUTE_REMOVE_ORIENTATION = "/remove-orientation";
|
||||||
public static final String TEMPLATE_ATTRIBUTE_ATTACH_DEFAULT_ORIENTATION = "attach-default-orientation";
|
public static final String TEMPLATE_ATTRIBUTE_ATTACH_DEFAULT_ORIENTATION = "/attach-default-orientation";
|
||||||
|
|
||||||
public static final String ORIENTATION_ENDPOINT = "/orientation";
|
public static final String ORIENTATION_ENDPOINT = "/orientation";
|
||||||
public static final String VIEW_ENDPOINT = ORIENTATION_ENDPOINT + "/view";
|
public static final String VIEW_ENDPOINT = ORIENTATION_ENDPOINT + "/view";
|
||||||
|
|
|
@ -52,7 +52,7 @@ import ch.ethz.seb.sebserver.gui.service.page.impl.PageAction;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCallError;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCallError;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestService;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestService;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.AttchDefaultOrientation;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.AttachDefaultOrientation;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetConfigAttributes;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetConfigAttributes;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetConfigurationValues;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetConfigurationValues;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetOrientations;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetOrientations;
|
||||||
|
@ -297,14 +297,14 @@ public class ExamConfigurationServiceImpl implements ExamConfigurationService {
|
||||||
if (selection != null && !selection.isEmpty()) {
|
if (selection != null && !selection.isEmpty()) {
|
||||||
selection.stream().forEach(entityKey -> {
|
selection.stream().forEach(entityKey -> {
|
||||||
callTemplateAction(
|
callTemplateAction(
|
||||||
AttchDefaultOrientation.class,
|
AttachDefaultOrientation.class,
|
||||||
parentEntityKey.modelId,
|
parentEntityKey.modelId,
|
||||||
entityKey.modelId);
|
entityKey.modelId);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
final EntityKey entityKey = action.getEntityKey();
|
final EntityKey entityKey = action.getEntityKey();
|
||||||
callTemplateAction(
|
callTemplateAction(
|
||||||
AttchDefaultOrientation.class,
|
AttachDefaultOrientation.class,
|
||||||
parentEntityKey.modelId,
|
parentEntityKey.modelId,
|
||||||
entityKey.modelId);
|
entityKey.modelId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,9 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
@Lazy
|
@Lazy
|
||||||
@Component
|
@Component
|
||||||
@GuiProfile
|
@GuiProfile
|
||||||
public class AttchDefaultOrientation extends RestCall<TemplateAttribute> {
|
public class AttachDefaultOrientation extends RestCall<TemplateAttribute> {
|
||||||
|
|
||||||
public AttchDefaultOrientation() {
|
public AttachDefaultOrientation() {
|
||||||
super(new TypeKey<>(
|
super(new TypeKey<>(
|
||||||
CallType.SAVE,
|
CallType.SAVE,
|
||||||
EntityType.CONFIGURATION_NODE,
|
EntityType.CONFIGURATION_NODE,
|
|
@ -276,7 +276,7 @@ public class ConfigurationNodeController extends EntityController<ConfigurationN
|
||||||
EntityType.CONFIGURATION_NODE))));
|
EntityType.CONFIGURATION_NODE))));
|
||||||
}
|
}
|
||||||
|
|
||||||
Configuration config = doImport
|
final Configuration config = doImport
|
||||||
.getOrThrow();
|
.getOrThrow();
|
||||||
|
|
||||||
return this.configurationDAO
|
return this.configurationDAO
|
||||||
|
@ -353,15 +353,16 @@ public class ConfigurationNodeController extends EntityController<ConfigurationN
|
||||||
filterMap)
|
filterMap)
|
||||||
.getOrThrow();
|
.getOrThrow();
|
||||||
|
|
||||||
final int start = (pageNumber - 1) * pageSize;
|
final int start = (this.paginationService.getPageNumber(pageNumber) - 1) *
|
||||||
int end = start + pageSize;
|
this.paginationService.getPageSize(pageSize);
|
||||||
|
int end = start + this.paginationService.getPageSize(pageSize);
|
||||||
if (attrs.size() < end) {
|
if (attrs.size() < end) {
|
||||||
end = attrs.size();
|
end = attrs.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Page<>(
|
return new Page<>(
|
||||||
attrs.size() / pageSize,
|
attrs.size() / this.paginationService.getPageSize(pageSize),
|
||||||
pageNumber,
|
this.paginationService.getPageNumber(pageNumber),
|
||||||
sort,
|
sort,
|
||||||
attrs.subList(start, end));
|
attrs.subList(start, end));
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,6 @@ package ch.ethz.seb.sebserver.gui.integration;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -22,7 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||||
import org.springframework.security.web.FilterChainProxy;
|
import org.springframework.security.web.FilterChainProxy;
|
||||||
import org.springframework.test.context.ActiveProfiles;
|
import org.springframework.test.context.ActiveProfiles;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
@ -79,18 +76,7 @@ public abstract class GuiIntegrationTest {
|
||||||
final ClientHttpRequestFactoryService clientHttpRequestFactoryService = Mockito
|
final ClientHttpRequestFactoryService clientHttpRequestFactoryService = Mockito
|
||||||
.mock(ClientHttpRequestFactoryService.class);
|
.mock(ClientHttpRequestFactoryService.class);
|
||||||
Mockito.when(clientHttpRequestFactoryService.getClientHttpRequestFactory()).thenReturn(
|
Mockito.when(clientHttpRequestFactoryService.getClientHttpRequestFactory()).thenReturn(
|
||||||
Result.of(
|
Result.of(new HttpComponentsClientHttpRequestFactory()));
|
||||||
new SimpleClientHttpRequestFactory() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void prepareConnection(
|
|
||||||
final HttpURLConnection connection,
|
|
||||||
final String httpMethod) throws IOException {
|
|
||||||
|
|
||||||
super.prepareConnection(connection, httpMethod);
|
|
||||||
connection.setInstanceFollowRedirects(false);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
return new OAuth2AuthorizationContextHolder(
|
return new OAuth2AuthorizationContextHolder(
|
||||||
this.clientId,
|
this.clientId,
|
||||||
|
|
|
@ -65,6 +65,7 @@ import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationTableValues.TableV
|
||||||
import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationValue;
|
import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationValue;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.sebconfig.Orientation;
|
import ch.ethz.seb.sebserver.gbl.model.sebconfig.Orientation;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.sebconfig.SebClientConfig;
|
import ch.ethz.seb.sebserver.gbl.model.sebconfig.SebClientConfig;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.model.sebconfig.TemplateAttribute;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.sebconfig.View;
|
import ch.ethz.seb.sebserver.gbl.model.sebconfig.View;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.user.PasswordChange;
|
import ch.ethz.seb.sebserver.gbl.model.user.PasswordChange;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.user.UserInfo;
|
import ch.ethz.seb.sebserver.gbl.model.user.UserInfo;
|
||||||
|
@ -104,6 +105,7 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.clientconfig.
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.clientconfig.GetClientConfigPage;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.clientconfig.GetClientConfigPage;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.clientconfig.NewClientConfig;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.clientconfig.NewClientConfig;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.clientconfig.SaveClientConfig;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.clientconfig.SaveClientConfig;
|
||||||
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.AttachDefaultOrientation;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.CopyConfiguration;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.CopyConfiguration;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.ExportPlainXML;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.ExportPlainXML;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetConfigAttributes;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetConfigAttributes;
|
||||||
|
@ -125,6 +127,8 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.Ge
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.ImportExamConfigOnExistingConfig;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.ImportExamConfigOnExistingConfig;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.ImportNewExamConfig;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.ImportNewExamConfig;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.NewExamConfig;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.NewExamConfig;
|
||||||
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.RemoveOrientation;
|
||||||
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.ResetTemplateValues;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.SaveExamConfig;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.SaveExamConfig;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.SaveExamConfigHistory;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.SaveExamConfigHistory;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.SaveExamConfigTableValues;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.SaveExamConfigTableValues;
|
||||||
|
@ -1433,11 +1437,19 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest {
|
||||||
.stream()
|
.stream()
|
||||||
.filter(attr -> "URLFilterEnable".equals(attr.name))
|
.filter(attr -> "URLFilterEnable".equals(attr.name))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
|
.or(() -> {
|
||||||
|
fail("Expected one attribute");
|
||||||
|
return null;
|
||||||
|
})
|
||||||
.ifPresent(
|
.ifPresent(
|
||||||
attr -> {
|
attr -> {
|
||||||
values.stream()
|
values.stream()
|
||||||
.filter(cv -> cv.attributeId.equals(attr.id))
|
.filter(cv -> cv.attributeId.equals(attr.id))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
|
.or(() -> {
|
||||||
|
fail("Expected one attribute");
|
||||||
|
return null;
|
||||||
|
})
|
||||||
.ifPresent(
|
.ifPresent(
|
||||||
val -> assertEquals(Constants.TRUE_STRING, val.value));
|
val -> assertEquals(Constants.TRUE_STRING, val.value));
|
||||||
});
|
});
|
||||||
|
@ -1446,18 +1458,30 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest {
|
||||||
.stream()
|
.stream()
|
||||||
.filter(attr -> "URLFilterRules".equals(attr.name))
|
.filter(attr -> "URLFilterRules".equals(attr.name))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
|
.or(() -> {
|
||||||
|
fail("Expected one attribute");
|
||||||
|
return null;
|
||||||
|
})
|
||||||
.ifPresent(
|
.ifPresent(
|
||||||
parent -> {
|
parent -> {
|
||||||
attributes.stream()
|
attributes.stream()
|
||||||
.filter(attr -> parent.id.equals(attr.parentId)
|
.filter(attr -> parent.id.equals(attr.parentId)
|
||||||
&& "URLFilterRules.expression".equals(attr.name))
|
&& "URLFilterRules.expression".equals(attr.name))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
|
.or(() -> {
|
||||||
|
fail("Expected one attribute");
|
||||||
|
return null;
|
||||||
|
})
|
||||||
.ifPresent(
|
.ifPresent(
|
||||||
tAttr -> {
|
tAttr -> {
|
||||||
values.stream()
|
values.stream()
|
||||||
.filter(tVal -> tVal.attributeId.equals(tAttr.id)
|
.filter(tVal -> tVal.attributeId.equals(tAttr.id)
|
||||||
&& tVal.listIndex == 0)
|
&& tVal.listIndex == 0)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
|
.or(() -> {
|
||||||
|
fail("Expected one value");
|
||||||
|
return null;
|
||||||
|
})
|
||||||
.ifPresent(
|
.ifPresent(
|
||||||
firstTVal -> assertEquals("jrtjrtzj", firstTVal.value));
|
firstTVal -> assertEquals("jrtjrtzj", firstTVal.value));
|
||||||
});
|
});
|
||||||
|
@ -1544,8 +1568,12 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest {
|
||||||
@Order(15)
|
@Order(15)
|
||||||
// *************************************
|
// *************************************
|
||||||
// Use Case 15: Login as examAdmin2 and get views and orientations
|
// Use Case 15: Login as examAdmin2 and get views and orientations
|
||||||
// - test Views API
|
// - Test Views API
|
||||||
// - create configuration template form existing configuration
|
// - Create configuration template form existing configuration
|
||||||
|
// - Check views and orientation created for template
|
||||||
|
// - Remove one template attribute from orientation
|
||||||
|
// - Change one template attribute value
|
||||||
|
// - Reset template values
|
||||||
public void testUsecase15() throws IOException {
|
public void testUsecase15() throws IOException {
|
||||||
final RestServiceImpl restService = createRestServiceForUser(
|
final RestServiceImpl restService = createRestServiceForUser(
|
||||||
"examAdmin2",
|
"examAdmin2",
|
||||||
|
@ -1557,7 +1585,14 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest {
|
||||||
new CopyConfiguration(),
|
new CopyConfiguration(),
|
||||||
new GetTemplateAttributePage(),
|
new GetTemplateAttributePage(),
|
||||||
new GetExamConfigNodePage(),
|
new GetExamConfigNodePage(),
|
||||||
new GetTemplateAttribute());
|
new GetTemplateAttribute(),
|
||||||
|
new GetConfigurationValues(),
|
||||||
|
new GetConfigurationValuePage(),
|
||||||
|
new SaveExamConfigValue(),
|
||||||
|
new GetFollowupConfiguration(),
|
||||||
|
new RemoveOrientation(),
|
||||||
|
new AttachDefaultOrientation(),
|
||||||
|
new ResetTemplateValues());
|
||||||
|
|
||||||
final List<View> views = restService
|
final List<View> views = restService
|
||||||
.getBuilder(GetViews.class)
|
.getBuilder(GetViews.class)
|
||||||
|
@ -1572,6 +1607,7 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest {
|
||||||
.getBuilder(GetOrientations.class)
|
.getBuilder(GetOrientations.class)
|
||||||
.call()
|
.call()
|
||||||
.getOrThrow();
|
.getOrThrow();
|
||||||
|
assertNotNull(orientations);
|
||||||
orientations.forEach(o -> assertEquals(o.templateId, ConfigurationNode.DEFAULT_TEMPLATE_ID));
|
orientations.forEach(o -> assertEquals(o.templateId, ConfigurationNode.DEFAULT_TEMPLATE_ID));
|
||||||
|
|
||||||
// get configuration page and first config from the page to copy as template
|
// get configuration page and first config from the page to copy as template
|
||||||
|
@ -1612,7 +1648,95 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest {
|
||||||
assertNotNull(newTemplate);
|
assertNotNull(newTemplate);
|
||||||
assertEquals("Config Template", newTemplate.name);
|
assertEquals("Config Template", newTemplate.name);
|
||||||
|
|
||||||
assertNotNull(orientations);
|
// check views for template where created
|
||||||
|
final List<View> templateViews = restService
|
||||||
|
.getBuilder(GetViews.class)
|
||||||
|
.withQueryParam(View.FILTER_ATTR_TEMPLATE, String.valueOf(template.id))
|
||||||
|
.call()
|
||||||
|
.getOrThrow();
|
||||||
|
|
||||||
|
assertNotNull(templateViews);
|
||||||
|
assertFalse(templateViews.isEmpty());
|
||||||
|
assertEquals(11, templateViews.size());
|
||||||
|
|
||||||
|
// check orientations for template where created
|
||||||
|
final List<Orientation> templateTrientations = restService
|
||||||
|
.getBuilder(GetOrientations.class)
|
||||||
|
.withQueryParam(Orientation.FILTER_ATTR_TEMPLATE_ID, String.valueOf(template.id))
|
||||||
|
.call()
|
||||||
|
.getOrThrow();
|
||||||
|
assertNotNull(templateTrientations);
|
||||||
|
assertFalse(templateTrientations.isEmpty());
|
||||||
|
assertEquals(192, templateTrientations.size());
|
||||||
|
|
||||||
|
// get template attributes page
|
||||||
|
final Page<TemplateAttribute> templateAttributes = restService
|
||||||
|
.getBuilder(GetTemplateAttributePage.class)
|
||||||
|
.withURIVariable(API.PARAM_PARENT_MODEL_ID, String.valueOf(template.id))
|
||||||
|
.call()
|
||||||
|
.getOrThrow();
|
||||||
|
|
||||||
|
assertNotNull(templateAttributes);
|
||||||
|
assertFalse(templateAttributes.isEmpty());
|
||||||
|
final TemplateAttribute templateAttr = templateAttributes.content.get(0);
|
||||||
|
assertEquals(template.id, templateAttr.templateId);
|
||||||
|
final Orientation orientation = templateAttr.getOrientation();
|
||||||
|
assertNotNull(orientation);
|
||||||
|
|
||||||
|
TemplateAttribute savedTAttribute = restService
|
||||||
|
.getBuilder(RemoveOrientation.class)
|
||||||
|
.withURIVariable(API.PARAM_PARENT_MODEL_ID, String.valueOf(template.id))
|
||||||
|
.withURIVariable(API.PARAM_MODEL_ID, templateAttr.getModelId())
|
||||||
|
.call()
|
||||||
|
.getOrThrow();
|
||||||
|
|
||||||
|
assertNotNull(savedTAttribute);
|
||||||
|
assertNull(savedTAttribute.getOrientation());
|
||||||
|
|
||||||
|
// Re-attach default orientation
|
||||||
|
savedTAttribute = restService
|
||||||
|
.getBuilder(AttachDefaultOrientation.class)
|
||||||
|
.withURIVariable(API.PARAM_PARENT_MODEL_ID, String.valueOf(template.id))
|
||||||
|
.withURIVariable(API.PARAM_MODEL_ID, templateAttr.getModelId())
|
||||||
|
.call()
|
||||||
|
.getOrThrow();
|
||||||
|
|
||||||
|
assertNotNull(savedTAttribute);
|
||||||
|
assertNotNull(savedTAttribute.getOrientation());
|
||||||
|
assertEquals(orientation.viewId, savedTAttribute.getOrientation().viewId);
|
||||||
|
assertEquals(orientation.templateId, savedTAttribute.getOrientation().templateId);
|
||||||
|
assertEquals(orientation.attributeId, savedTAttribute.getOrientation().attributeId);
|
||||||
|
|
||||||
|
// get first value and change it
|
||||||
|
final Configuration fallow_up = restService.getBuilder(GetFollowupConfiguration.class)
|
||||||
|
.withURIVariable(API.PARAM_MODEL_ID, String.valueOf(template.id))
|
||||||
|
.call()
|
||||||
|
.getOrThrow();
|
||||||
|
assertNotNull(fallow_up);
|
||||||
|
|
||||||
|
final List<ConfigurationValue> values = restService
|
||||||
|
.getBuilder(GetConfigurationValues.class)
|
||||||
|
.withQueryParam(ConfigurationValue.FILTER_ATTR_CONFIGURATION_ID, String.valueOf(fallow_up.id))
|
||||||
|
.withQueryParam(ConfigurationValue.FILTER_ATTR_CONFIGURATION_ATTRIBUTE_ID, savedTAttribute.getModelId())
|
||||||
|
.call()
|
||||||
|
.getOrThrow();
|
||||||
|
|
||||||
|
assertNotNull(values);
|
||||||
|
assertTrue(values.size() == 1);
|
||||||
|
final ConfigurationValue templateValue = values.get(0);
|
||||||
|
assertNull(templateValue.value);
|
||||||
|
|
||||||
|
final ConfigurationValue newValue = new ConfigurationValue(
|
||||||
|
templateValue.id, templateValue.institutionId, savedTAttribute.getTemplateId(),
|
||||||
|
templateValue.attributeId, 0, "123");
|
||||||
|
final ConfigurationValue newTemplValue = restService
|
||||||
|
.getBuilder(SaveExamConfigValue.class)
|
||||||
|
.withBody(newValue)
|
||||||
|
.call()
|
||||||
|
.getOrThrow();
|
||||||
|
assertNotNull(newTemplValue);
|
||||||
|
assertEquals("123", newTemplValue.value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue