Search in sources :

Example 6 with WriteContext

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);
}
Also used : WriteContext(one.kii.summer.io.context.WriteContext) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 7 with WriteContext

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));
}
Also used : Panic(one.kii.summer.io.exception.Panic) ExtensionDai(one.kii.kiimate.model.core.dai.ExtensionDai) WriteContext(one.kii.summer.io.context.WriteContext) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 8 with WriteContext

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);
}
Also used : WriteContext(one.kii.summer.io.context.WriteContext) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 9 with WriteContext

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);
}
Also used : WriteContext(one.kii.summer.io.context.WriteContext)

Example 10 with WriteContext

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);
}
Also used : RevokeIntensionApi(one.kii.kiimate.model.core.api.RevokeIntensionApi) WriteContext(one.kii.summer.io.context.WriteContext)

Aggregations

WriteContext (one.kii.summer.io.context.WriteContext)12 Test (org.junit.Test)8 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)8 PublishModelApi (one.kii.kiimate.model.core.api.PublishModelApi)1 RevokeIntensionApi (one.kii.kiimate.model.core.api.RevokeIntensionApi)1 SubscribeModelsApi (one.kii.kiimate.model.core.api.SubscribeModelsApi)1 ExtensionDai (one.kii.kiimate.model.core.dai.ExtensionDai)1 AnSubscribeModelExtractor (one.kii.kiimate.model.core.fui.AnSubscribeModelExtractor)1 RefreshStatusApi (one.kii.kiimate.status.core.api.RefreshStatusApi)1 Conflict (one.kii.summer.io.exception.Conflict)1 Panic (one.kii.summer.io.exception.Panic)1