Package org.rhq.core.domain.resource

Examples of org.rhq.core.domain.resource.Agent


            throw nre;
        }
    }

    protected void setUpAgent(Resource testResource) {
        Agent agent;
        try {
            agent = getAgent();
        } catch (NoResultException nre) {
            agent = new Agent(AGENT_NAME, "localhost", 12345, "http://localhost:12345/", "-dummy token-");
            em.persist(agent);
        }

        testResource.setAgent(agent);
        agentServiceContainer.addStartedAgent(agent);
View Full Code Here


        int serverId = LookupUtil.getServerManager().create(server);
        assert serverId > 0 : "could not create our server identity in the DB";

        // simulate the agent being "connected" to the server
        try {
            Agent agent = getAgent();
            agent.setServer(server);
            LookupUtil.getAgentManager().updateAgent(agent);
        } catch (NoResultException nre) {
            // no agent to attach
        }
    }
View Full Code Here

        getTransactionManager().begin();

        try {
            try {
                int agentId = getAgentId();
                Agent agent = em.getReference(Agent.class, agentId);
                if (null != agent) {
                    em.remove(agent);
                }
            } catch (NoResultException nre) {
                // ignore, nothing to clean up
View Full Code Here

                template.setTemplateDefinition(templateDef);
                template.setUserDefined(true);
                resourceType.addDriftDefinitionTemplate(template);
                em.persist(resourceType);

                Agent agent = new Agent("testagent", "testaddress", 1, "", "testtoken");
                em.persist(agent);
                em.flush();

                DriftDefinition test1Def = new DriftDefinition(new Configuration());
                test1Def.setName("test-1");
View Full Code Here

                // now dispose of other hibernate entities
                getTransactionManager().begin();

                ResourceType type = em.find(ResourceType.class, resource.getResourceType().getId());
                Agent agent = em.find(Agent.class, resource.getAgent().getId());
                if (null != agent) {
                    em.remove(agent);
                }
                if (null != type) {
                    em.remove(type);
View Full Code Here

        }
    }

    private void setupTest(int numServers, int numAgents) throws Exception {
        Server server = ServerFactory.newInstance();
        Agent agent;

        getTransactionManager().begin();

        try {
            for (int i = 0; (i < numServers); ++i) {
                server = ServerFactory.newInstance();
                server.setName("Server-flm-" + i);
                server.setAddress("" + i);
                server.setPort(i);
                server.setSecurePort(i);
                server.setOperationMode(Server.OperationMode.NORMAL);
                em.persist(server);
                servers.add(server);
            }

            for (int i = 0; (i < numAgents); ++i) {
                agent = new Agent("Agent-flm-" + i, "" + i, 1, "endpoint", "token" + i);
                em.persist(agent);
                agents.add(agent);
            }

            ag = new AffinityGroup("AG-flm-1");
View Full Code Here

        getTransactionManager().begin();

        try {
            for (int i = 0; (i < numNewAgents); ++i) {

                Agent agent = new Agent("Agent-flm-NEW" + i, "NEW-" + i, 1, "endpoint", "token-NEW-" + i);
                em.persist(agent);
                newAgents.add(agent);
            }

            getTransactionManager().commit();
View Full Code Here

            public void execute() throws Exception {

                resourceType = new ResourceType(RESOURCE_TYPE, PLUGIN, SERVER, null);
                em.persist(resourceType);

                agent = new Agent(AGENT_NAME, "localhost", 9999, "", "randomToken");
                em.persist(agent);

                resource = new Resource(RESOURCE_KEY, RESOURCE_NAME, resourceType);
                resource.setUuid(RESOURCE_UUID);
                resource.setAgent(agent);
View Full Code Here

     *
     * @param  em The EntityManager to use
     *
     */
    private void setupResources(EntityManager em) {
        theAgent = new Agent("testagent", "localhost", 1234, "", "randomToken");
        em.persist(theAgent);

        theResourceType = new ResourceType("test-plat", "test-plugin", ResourceCategory.PLATFORM, null);
        em.persist(theResourceType);

View Full Code Here

     * @param  em The EntityManager to use
     *
     */
    @SuppressWarnings("unchecked")
    private void setupGroupOfResources(EntityManager em) {
        theAgent = new Agent("testagent", "localhost", 1234, "", "randomToken");
        em.persist(theAgent);

        theResourceType = new ResourceType("test-plat", "test-plugin", ResourceCategory.PLATFORM, null);
        em.persist(theResourceType);

View Full Code Here

TOP

Related Classes of org.rhq.core.domain.resource.Agent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.