Exemple #1
0
TEST(DeleteTest, testSimpleDelete ) {
    Fixture f;
    f.login();
    ServiceFactoryPrx sf = f.client->getSession();

    IQueryPrx iquery = sf->getQueryService();
    IUpdatePrx iupdate = sf->getUpdateService();

    ImagePtr image = new ImageI();
    image->setName( rstring("testSimpleDelete") );
    image = ImagePtr::dynamicCast( iupdate->saveAndReturnObject( image ) );

    omero::api::LongList imageIds;
    omero::api::StringLongListMap objects;
    ChildOptions options;
    Delete2Ptr deleteCmd = new Delete2();
    imageIds.push_back( image->getId()->getValue() );
    objects["Image"] = imageIds;
    deleteCmd->targetObjects = objects;
    deleteCmd->childOptions = options;

    // Submit and wait for completion
    HandlePrx handle = sf->submit( deleteCmd );
    CmdCallbackIPtr cb = new CmdCallbackI(f.client, handle);
    ResponsePtr resp = cb->loop(10, 500);

    ERRPtr err = ERRPtr::dynamicCast(resp);
    if (err) {
        FAIL() << "Failed to delete image: " << err->category << ", " << err->name << endl;
    }
}
Exemple #2
0
TEST(ChgrpTest, testSimpleChgrp ) {
    Fixture f;
    ExperimenterGroupPtr g1 = f.newGroup();
    ExperimenterGroupPtr g2 = f.newGroup();
    ExperimenterPtr user = f.newUser(g1);
    f.addExperimenter(g2, user);

    client_ptr c = f.login(user->getOmeName()->getValue());
    ServiceFactoryPrx sf = c->getSession();
    IAdminPrx admin = sf->getAdminService();
    ASSERT_EQ(g1->getId()->getValue(), admin->getEventContext()->groupId);

    IQueryPrx iquery = sf->getQueryService();
    IUpdatePrx iupdate = sf->getUpdateService();

    ImagePtr image = new ImageI();
    image->setName( rstring("testSimpleChgrp") );
    image->setAcquisitionDate( rtime(0) );
    image = ImagePtr::dynamicCast( iupdate->saveAndReturnObject( image ) );

    std::map<string, string> options;
    ChgrpPtr chgrp = new Chgrp();
    chgrp->type = "/Image";
    chgrp->id = image->getId()->getValue();
    chgrp->grp = g2->getId()->getValue();
    chgrp->options = options;

    HandlePrx handle = sf->submit( chgrp );
    CmdCallbackIPtr cb = new CmdCallbackI(c, handle);
    ResponsePtr rsp = cb->loop(10, 500);
    ERRPtr err = ERRPtr::dynamicCast(rsp);
    if (err) {
        FAIL() << "ERR returned";
    }

}