Package org.rhq.enterprise.server.test

Examples of org.rhq.enterprise.server.test.TransactionCallback


        });
    }

    @Test
    public void testSetAssignedResourceGroups() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                Subject subject = SessionTestHelper.createNewSubject(em, "fake subject");
                Role role = SessionTestHelper.createNewRoleForSubject(em, subject, "fake role");
                List<ResourceGroup> resourceGroups = new ArrayList<ResourceGroup>();
View Full Code Here


        });
    }

    @Test
    public void testSetAssignedSubjects() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                Subject subject = SessionTestHelper.createNewSubject(em, "fake subject");
                Role role = SessionTestHelper.createNewRoleForSubject(em, subject, "fake role");
                List<Subject> subjects = new ArrayList<Subject>();
View Full Code Here

        });
    }

    @Test
    public void testSetRolesFromResourceGroup() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                Subject subject = SessionTestHelper.createNewSubject(em, "fake subject");
                Role role = SessionTestHelper.createNewRoleForSubject(em, subject, "fake role");
                ResourceGroup resourceGroup = SessionTestHelper.createNewCompatibleGroupForRole(em, role,
View Full Code Here

        final MeasurementDefinition metricDef = resourceType.getMetricDefinitions().iterator().next();

        resource = persistNewResource(resourceType.getName()); // will have UNKNOWN avail
        assert resource != null && resource.getId() > 0 : "failed to create test resource";

        executeInTransaction(false, new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                MeasurementSchedule schedule = new MeasurementSchedule(metricDef, resource);
                em.persist(schedule);
            }
View Full Code Here

        });
    }

    @Test
    public void testAcknowledgeAlertsByResourceContext() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                int resourceAlertDefinitionId = createResourceAlertDefinitionAndGetId("fake resource alertdef");
                alertManager.fireAlert(resourceAlertDefinitionId);
View Full Code Here

        });
    }

    @Test
    public void testAcknowledgeAlertsByGroupContext() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                int resourceAlertDefinitionId = createResourceAlertDefinitionAndGetId("fake resource alertdef");
                alertManager.fireAlert(resourceAlertDefinitionId);
View Full Code Here

        });
    }

    @Test
    public void testAcknowledgeAlertsBySubsystemContext() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                int resourceAlertDefinitionId = createResourceAlertDefinitionAndGetId("fake resource alertdef");
                alertManager.fireAlert(resourceAlertDefinitionId);
View Full Code Here

        }
    }

    //@BeforeClass
    private void prepareDB() {
        executeInTransaction(false, new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                EntityManager em = getEntityManager();

                agent = new Agent(universalName, "localhost", 0, "foo", "bar");
View Full Code Here

        removeNoExceptions(templateAlertDefinition);

        LookupUtil.getResourceGroupManager().deleteResourceGroup(LookupUtil.getSubjectManager().getOverlord(),
            resourceGroup.getId());

        executeInTransaction(false, new TransactionCallback() {
            public void execute() throws Exception {
                em.createQuery(
                    "delete from AlertNotification an where an.senderName like '" + TestAlertSender.NAME + "%'")
                    .executeUpdate();
                em.createQuery("delete from AlertCondition ac where ac.name like '" + universalName + "%'")
                    .executeUpdate();
                em.createQuery("delete from AlertDefinition ad where ad.name like '" + universalName + "%'")
                    .executeUpdate();
            }
        });

        executeInTransaction(false, new TransactionCallback() {
            public void execute() throws Exception {
                em.clear();
                for (Resource r : resources) {
                    r = em.find(Resource.class, r.getId());
                    try {
View Full Code Here

            TestAlertSender.getValidateMethodCallCount());
    }

    private void removeNoExceptions(final Object o) {
        try {
            executeInTransaction(false, new TransactionCallback() {
                public void execute() {
                    EntityManager em = getEntityManager();
                    Object o2 = em.merge(o);

                    if (o2 instanceof Resource) {
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.test.TransactionCallback

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.