Ejemplo n.º 1
0
void runCIMNameCastTests()
{
    try
    {
        CIMName name(CIMNameCast("Okay"));
    }
    catch (...)
    {
        PEGASUS_TEST_ASSERT(false);
    }

    Boolean caught = false;

    try
    {
        CIMName name(CIMNameCast("Not Okay"));
    }
    catch (InvalidNameException& e)
    {
        caught = true;
    }
    catch (...)
    {
        PEGASUS_TEST_ASSERT(false);
    }

#if defined(PEGASUS_DEBUG)
    PEGASUS_TEST_ASSERT(caught);
#else
    PEGASUS_TEST_ASSERT(!caught);
#endif
}
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////
//
//%/////////////////////////////////////////////////////////////////////////////

#include <Pegasus/Common/CIMNameCast.h>
#include "IndicationHandlerConstants.h"

PEGASUS_NAMESPACE_BEGIN

#ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
const CIMName _PROPERTY_LSTNRDST_NAME =
    CIMNameCast("ListenerDestinationName");

const CIMName _PROPERTY_CREATIONTIME =
    CIMNameCast("CreationTime");

const CIMName _PROPERTY_SEQUENCECONTEXT =
    CIMNameCast("SequenceContext");

const CIMName _PROPERTY_NEXTSEQUENCENUMBER =
    CIMNameCast("NextSequenceNumber");

const CIMName _PROPERTY_MAXQUEUELENGTH =
    CIMNameCast("MaxQueueLength");

const CIMName _PROPERTY_SEQUENCEIDENTIFIERLIFETIME =
    CIMNameCast("SequenceIdentifierLifetime");
Ejemplo n.º 3
0
//
//%/////////////////////////////////////////////////////////////////////////////

#include <Pegasus/Common/Config.h>
#include <Pegasus/Common/PegasusAssert.h>
#include <Pegasus/Common/CIMName.h>
#include <Pegasus/Common/CIMNameCast.h>
#include <Pegasus/Common/CIMInstance.h>
#include <Pegasus/Client/CIMClient.h>

PEGASUS_USING_PEGASUS;
PEGASUS_USING_STD;


const CIMNamespaceName PROVIDERNAMESPACE=CIMNamespaceName ("test/TestProvider");
const CIMName CLASSNAME=CIMNameCast("TestCMPI_KeyReturned");

Boolean verbose;

void _checkResult(const Array<CIMInstance> & instArr)
{
    // provider returns exactly six instances
    PEGASUS_TEST_ASSERT(6==instArr.size());

    for (int i=0; i<6;i++)
    {
        const CIMObjectPath& objPath = instArr[i].getPath();
        const Array<CIMKeyBinding>& keyBinds = objPath.getKeyBindings();

        // instance should have three key bindings
        PEGASUS_TEST_ASSERT(3==keyBinds.size());
Ejemplo n.º 4
0
void DefaultPropertyOwner::_requestIndicationServiceStateChange(
    const String& userName,
    Boolean enable,
    Uint32 timeoutSeconds)
{
    MessageQueue *queue = MessageQueue::lookup(
        PEGASUS_QUEUENAME_INDICATIONSERVICE);
    // Return if indication service can not be found
    if (!queue)
    {
        return;
    }

    Uint32 queueId = queue->getQueueId();

    const String METHOD_NAME = "RequestStateChange";
    const String PARAMNAME_REQUESTEDSTATE = "RequestedState";
    const String PARAMNAME_TIMEOUTPERIOD = "TimeoutPeriod";
    const Uint16 STATE_ENABLED = 2;
    const Uint16 STATE_DISABLED = 3;

    String referenceStr("//", 2);
    referenceStr.append(System::getHostName());
    referenceStr.append("/");
    referenceStr.append(PEGASUS_NAMESPACENAME_INTEROP.getString());
    referenceStr.append(":");
    referenceStr.append(
        PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE.getString());
    CIMObjectPath reference(referenceStr);

    Array<CIMParamValue> inParams;
    Array<CIMParamValue> outParams;

    inParams.append(CIMParamValue(PARAMNAME_REQUESTEDSTATE,
        CIMValue(enable ? STATE_ENABLED : STATE_DISABLED)));

    inParams.append(CIMParamValue(PARAMNAME_TIMEOUTPERIOD,
        CIMValue(CIMDateTime(timeoutSeconds * 1000000, true))));

    MessageQueueService *controller = ModuleController::getModuleController();

    try
    {
        CIMInvokeMethodRequestMessage* request =
            new CIMInvokeMethodRequestMessage(
                XmlWriter::getNextMessageId(),
                PEGASUS_NAMESPACENAME_INTEROP,
                referenceStr,
                CIMNameCast(METHOD_NAME),
                inParams,
                QueueIdStack(queueId));

        request->operationContext.insert(
            IdentityContainer(userName));

        AsyncLegacyOperationStart *asyncRequest =
            new AsyncLegacyOperationStart(
                0,
                queueId,
                request);

        AsyncReply * asyncReply = controller->SendWait(asyncRequest);

        CIMInvokeMethodResponseMessage * response =
            reinterpret_cast<CIMInvokeMethodResponseMessage *>(
                (static_cast<AsyncLegacyOperationResult *>(
                    asyncReply))->get_result());

        CIMException e = response->cimException;

        delete response;
        delete asyncRequest;
        delete asyncReply;

        if (e.getCode() != CIM_ERR_SUCCESS)
        {
            throw e;
        }
    }
    catch(const Exception &e)
    {
        PEG_TRACE((TRC_CONFIG,Tracer::LEVEL1,
            "Exception caught while invoking CIM_IndicationService."
                "RequestStateChange()  method: %s",
        (const char*)e.getMessage().getCString()));
        throw;
    }
    catch(...)
    {
        PEG_TRACE_CSTRING(TRC_CONFIG,Tracer::LEVEL1,
            "Unknown exception caught while invoking CIM_IndicationService."
                "RequestStateChange()  method");
        throw;
    }
}
Ejemplo n.º 5
0
#include <Pegasus/Common/ResponseHandler.h>
#include <Pegasus/Security/UserManager/UserManager.h>
#include <Pegasus/Security/UserManager/UserExceptions.h>
#include <Pegasus/Common/MessageLoader.h> //l10n

#include "UserAuthProvider.h"

PEGASUS_USING_STD;

PEGASUS_NAMESPACE_BEGIN

/**
    The constants representing the Username and Password properties in the
    schema.
*/
static const CIMName PROPERTY_NAME_USERNAME = CIMNameCast("Username");

static const CIMName PROPERTY_NAME_PASSWORD = CIMNameCast("Password");

static const char OLD_PASSWORD[] = "OldPassword";

static const char NEW_PASSWORD[] = "NewPassword";

/**
    The constants representing the namespace and authorization
    in the schema.
*/
static const CIMName PROPERTY_NAME_NAMESPACE       =
    CIMNameCast("Namespace");

static const CIMName PROPERTY_NAME_AUTHORIZATION   =
Ejemplo n.º 6
0
# include <ILEWrapper/qumemultiutil.h>
# include <ILEWrapper/ILEUtilities2.h>
#endif

#include "AuthorizationHandler.h"
#include "UserExceptions.h"

PEGASUS_USING_STD;

PEGASUS_NAMESPACE_BEGIN


//
// This constant represents the  User name property in the schema
//
static const CIMName PROPERTY_NAME_USERNAME = CIMNameCast("Username");

//
// This constant represents the Namespace property in the schema
//
static const CIMName PROPERTY_NAME_NAMESPACE = CIMNameCast("Namespace");

//
// This constant represents the Authorizations property in the schema
//
static const CIMName PROPERTY_NAME_AUTHORIZATION = CIMNameCast("Authorization");


//
// List of all the CIM Operations
//
Ejemplo n.º 7
0
#include <Pegasus/Common/MessageLoader.h> //l10n
#include <Pegasus/Common/ModuleController.h>
#include <Pegasus/Common/CIMMessage.h>
#include <Pegasus/Common/AutoPtr.h>
#include <Pegasus/Common/AuditLogger.h>


PEGASUS_USING_STD;

PEGASUS_NAMESPACE_BEGIN

/**
    The constants representing the string literals for property
    names of the PG_ConfigSetting class
*/
static const CIMName PROPERTY_NAME    = CIMNameCast("PropertyName");

static const CIMName DEFAULT_VALUE    = CIMNameCast("DefaultValue");

static const CIMName CURRENT_VALUE    = CIMNameCast("CurrentValue");

static const CIMName PLANNED_VALUE    = CIMNameCast("PlannedValue");

static const CIMName DYNAMIC_PROPERTY = CIMNameCast("DynamicProperty");
static const CIMName DESCRIPTION      = CIMNameCast("Description");


/**
    The name of the method that implements the property value update using the
    timeout period.
*/