use of one.kii.summer.io.context.WriteContext in project kiimate by SINeWang.
the class TestDeclareReceiptApi method testVisibilityOnly.
@Test
public void testVisibilityOnly() {
DeclareExtensionApi.CommitForm commitForm = new DeclareExtensionApi.CommitForm();
commitForm.setVisibility("testVisibility");
WriteContext context = new WriteContext(requestId, ownerId, operatorId);
DeclareExtensionApi.CommitReceipt response = null;
try {
response = declareExtensionApi.commit(context, commitForm);
} catch (Exception e) {
e.printStackTrace();
}
Assert.assertNull(response);
}
use of one.kii.summer.io.context.WriteContext in project kiimate by SINeWang.
the class TestDeclareReceiptApi method testSave.
@Test
public void testSave() {
String group = "testGroup";
String name = "testName";
String tree = "testTree";
DeclareExtensionApi.CommitForm commitForm = new DeclareExtensionApi.CommitForm();
commitForm.setGroup(group);
commitForm.setName(name);
commitForm.setTree(tree);
WriteContext context = new WriteContext(requestId, ownerId, operatorId);
commitForm.setVisibility("protected");
DeclareExtensionApi.CommitReceipt response = null;
try {
response = declareExtensionApi.commit(context, commitForm);
} catch (Exception e) {
e.printStackTrace();
}
String id = response.getId();
Assert.assertNotNull(id);
ExtensionDai.ChannelId extId = new ExtensionDai.ChannelId();
extId.setId(Long.valueOf(id));
ExtensionDai.Record record = null;
try {
record = extensionDai.loadLast(extId);
} catch (Panic panic) {
panic.printStackTrace();
}
Assert.assertNotNull(record);
extensionMapper.deleteExtensionById(Long.valueOf(id));
}
use of one.kii.summer.io.context.WriteContext in project kiimate by SINeWang.
the class TestDeclareReceiptApi method testInvalidVisibility.
@Test
public void testInvalidVisibility() {
DeclareExtensionApi.CommitForm commitForm = new DeclareExtensionApi.CommitForm();
commitForm.setGroup("testGroup");
commitForm.setName("testName");
commitForm.setTree("testTree");
commitForm.setVisibility("testVisibility");
WriteContext context = new WriteContext(requestId, ownerId, operatorId);
DeclareExtensionApi.CommitReceipt response = null;
try {
response = declareExtensionApi.commit(context, commitForm);
} catch (Exception e) {
e.printStackTrace();
}
Assert.assertNull(response);
}
use of one.kii.summer.io.context.WriteContext in project kiimate by SINeWang.
the class PublishModelCtl method commit.
private ResponseEntity<PublishModelApi.Receipt> commit(String requestId, String operatorId, String ownerId, String stability, PublishModelApi.Form form) {
form.setStability(stability);
WriteContext context = buildContext(requestId, operatorId, ownerId);
return CommitApiCaller.sync(api, context, form);
}
use of one.kii.summer.io.context.WriteContext in project kiimate by SINeWang.
the class RevokeIntensionCtl method commit.
@RequestMapping(method = RequestMethod.PATCH)
public ResponseEntity<RevokeIntensionApi.Receipt> commit(@RequestHeader(ErestHeaders.REQUEST_ID) String requestId, @RequestHeader(ErestHeaders.OPERATOR_ID) String operatorId, @PathVariable(OWNER_ID) String ownerId, @PathVariable(EXT_ID) Long extId, @PathVariable(INT_ID) Long intId) {
WriteContext context = buildContext(requestId, operatorId, ownerId);
RevokeIntensionApi.Form form = new RevokeIntensionApi.Form();
form.setId(intId);
form.setExtId(extId);
form.setOwnerId(ownerId);
return CommitApiCaller.sync(api, context, form);
}
Aggregations