Search in sources :

Example 11 with WriteContext

use of one.kii.summer.io.context.WriteContext in project kiimate by SINeWang.

the class TestPublishModelApi method test.

@Test
public void test() {
    PublishModelApi.Form form = new PublishModelApi.Form();
    form.setVersion(version);
    form.setProviderId(providerId);
    form.setExtId(extId);
    modelPublicationMapper.deletePublicationByProviderIdExtIdPubVersion(providerId, extId, "SNAPSHOT", version);
    WriteContext context = new WriteContext(requestId, ownerId, operatorId);
    PublishModelApi.Receipt receipt = null;
    try {
        receipt = publishModelApi.commit(context, form);
    } catch (Exception e) {
        e.printStackTrace();
    }
    Assert.assertNotNull(receipt);
    Assert.assertEquals(version, receipt.getVersion());
    Assert.assertEquals(ownerId, receipt.getOwnerId());
    Assert.assertEquals(providerId, receipt.getProviderId());
}
Also used : PublishModelApi(one.kii.kiimate.model.core.api.PublishModelApi) WriteContext(one.kii.summer.io.context.WriteContext) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 12 with WriteContext

use of one.kii.summer.io.context.WriteContext in project kiimate by SINeWang.

the class TestSubscribeModelsApi method test.

@Test
public void test() {
    SubscribeModelsApi.Form form = new SubscribeModelsApi.Form();
    form.setGroup("testGroup");
    form.setSubSet(pubSet);
    long id = idgen.born();
    AnSubscribeModelExtractor.ModelSubscription model = new AnSubscribeModelExtractor.ModelSubscription();
    model.setSubscriberId(subscriberId);
    model.setSubSet(pubSet);
    model.setGroup(group);
    model.setName(name);
    model.setTree(tree);
    modelSubscriptionMapper.deleteById(id);
    form.setGroup(group);
    form.setName(name);
    WriteContext context = new WriteContext(requestId, ownerId, operatorId);
    SubscribeModelsApi.Receipt receipt = null;
    try {
        receipt = subscribeModelsApi.commit(context, form);
    } catch (Conflict conflict) {
        conflict.printStackTrace();
    }
    modelSubscriptionMapper.deleteById(id);
}
Also used : Conflict(one.kii.summer.io.exception.Conflict) SubscribeModelsApi(one.kii.kiimate.model.core.api.SubscribeModelsApi) AnSubscribeModelExtractor(one.kii.kiimate.model.core.fui.AnSubscribeModelExtractor) WriteContext(one.kii.summer.io.context.WriteContext) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

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