Example usage for org.springframework.transaction.annotation Propagation NEVER

List of usage examples for org.springframework.transaction.annotation Propagation NEVER

Introduction

In this page you can find the example usage for org.springframework.transaction.annotation Propagation NEVER.

Prototype

Propagation NEVER

To view the source code for org.springframework.transaction.annotation Propagation NEVER.

Click Source Link

Document

Execute non-transactionally, throw an exception if a transaction exists.

Usage

From source file:com.vmware.bdd.manager.TestClusteringJobs.java

@Test(groups = { "TestClusteringJobs" }, dependsOnMethods = { "testCreateClusterFailed" })
@Transactional(propagation = Propagation.NEVER)
public void testClusterResume() throws Exception {
    long jobExecutionId = clusterMgr.resumeClusterCreation(TEST_DHCP_CLUSTER_NAME, new BaseConfiguration());
    ClusterRead cluster = clusterMgr.getClusterByName(TEST_DHCP_CLUSTER_NAME, false);
    Assert.assertTrue(cluster.getStatus() == ClusterStatus.PROVISIONING,
            "Cluster status should be PROVISIONING, but got " + cluster.getStatus());
    waitTaskFinished(jobExecutionId);/*w ww.j a v a2  s  . co  m*/
    cluster = clusterMgr.getClusterByName(TEST_DHCP_CLUSTER_NAME, false);
    Assert.assertTrue(cluster.getInstanceNum() == 3,
            "Cluster instance number should be 3, but got " + cluster.getInstanceNum());
    Assert.assertTrue(cluster.getStatus() == ClusterStatus.RUNNING,
            "Cluster status should be RUNNING, but got " + cluster.getStatus());
}

From source file:com.vmware.bdd.manager.TestClusteringJobs.java

@Test(groups = { "TestClusteringJobs" }, dependsOnMethods = { "testClusterResume" })
@Transactional(propagation = Propagation.NEVER)
public void testClusterResizeFailed() throws Exception {
    long jobExecutionId = clusterMgr.resizeCluster(TEST_DHCP_CLUSTER_NAME, "worker", 2, false,
            new BaseConfiguration());
    ClusterRead cluster = clusterMgr.getClusterByName(TEST_DHCP_CLUSTER_NAME, false);
    Assert.assertTrue(cluster.getStatus() == ClusterStatus.UPDATING,
            "Cluster status should be UPDATING, but got " + cluster.getStatus());
    stopVmAfterStarted(//from w w  w .  ja  va 2 s.com
            vcRP + "/" + ConfigInfo.getSerengetiUUID() + "-" + TEST_DHCP_CLUSTER_NAME + "/" + "worker",
            TEST_DHCP_CLUSTER_NAME + "-worker-1", jobExecutionId);
    waitTaskFinished(jobExecutionId);
    assertTaskFailed(jobExecutionId);
    assertDefinedInstanceNum(TEST_DHCP_CLUSTER_NAME, "worker", 1);

    cluster = clusterMgr.getClusterByName(TEST_DHCP_CLUSTER_NAME, false);
    Assert.assertTrue(cluster.getStatus() == ClusterStatus.RUNNING,
            "Cluster status should be RUNNING, but got " + cluster.getStatus());
    assertTaskFailed(jobExecutionId);
}

From source file:com.vmware.bdd.manager.TestClusteringJobs.java

@Test(groups = { "TestClusteringJobs" }, dependsOnMethods = { "testClusterResizeFailed" })
@Transactional(propagation = Propagation.NEVER)
public void testClusterResizeSuccess() throws Exception {
    stopVcVm(vcRP + "/" + ConfigInfo.getSerengetiUUID() + "-" + TEST_DHCP_CLUSTER_NAME + "/" + "worker",
            TEST_DHCP_CLUSTER_NAME + "-worker-0");
    long jobExecutionId = clusterMgr.resizeCluster(TEST_DHCP_CLUSTER_NAME, "worker", 2, false,
            new BaseConfiguration());
    ClusterRead cluster = clusterMgr.getClusterByName(TEST_DHCP_CLUSTER_NAME, false);
    Assert.assertTrue(cluster.getStatus() == ClusterStatus.UPDATING,
            "Cluster status should be UPDATING, but got " + cluster.getStatus());
    waitTaskFinished(jobExecutionId);/* www .j  a  v a2s  .c  o  m*/
    assertTaskSuccess(jobExecutionId);
    assertDefinedInstanceNum(TEST_DHCP_CLUSTER_NAME, "worker", 2);
    NodeEntity node = clusterEntityMgr.findByName(TEST_DHCP_CLUSTER_NAME, "worker",
            TEST_DHCP_CLUSTER_NAME + "-worker-0");
    Assert.assertTrue(node.getStatus() == NodeStatus.POWERED_OFF, "Stopped vm " + TEST_DHCP_CLUSTER_NAME
            + "-worker-0" + " status should be Powered Off, but got " + node.getStatus());
    cluster = clusterMgr.getClusterByName(TEST_DHCP_CLUSTER_NAME, false);
    Assert.assertTrue(cluster.getStatus() == ClusterStatus.RUNNING,
            "Cluster status should be RUNNING, but got " + cluster.getStatus());
}

From source file:com.vmware.bdd.manager.TestClusteringJobs.java

@Test(groups = { "TestClusteringJobs" }, dependsOnMethods = { "testClusterResizeSuccess" })
@Transactional(propagation = Propagation.NEVER)
public void testDeleteDhcpCluster() throws Exception {
    long jobExecutionId = clusterMgr.deleteClusterByName(TEST_DHCP_CLUSTER_NAME);

    ClusterRead cluster = clusterMgr.getClusterByName(TEST_DHCP_CLUSTER_NAME, false);
    Assert.assertTrue(cluster.getStatus() == ClusterStatus.DELETING,
            "Cluster status should be DELETING, but got " + cluster.getStatus());
    waitTaskFinished(jobExecutionId);/*from w  ww.  j  ava  2  s  .  c  o m*/
    try {
        cluster = clusterMgr.getClusterByName(TEST_DHCP_CLUSTER_NAME, false);
        Assert.assertTrue(false, "Cluster should not be found.");
    } catch (BddException e) {
        if (e.getErrorId().equals("NOT_FOUND")) {
            Assert.assertTrue(true);
            return;
        }
        e.printStackTrace();
    }
}

From source file:com.vmware.bdd.manager.TestClusteringJobs.java

@Test(groups = { "TestClusteringJobs" }, dependsOnMethods = { "testLimitCluster" })
@Transactional(propagation = Propagation.NEVER)
public void testDupCreateCluster() throws Exception {
    ClusterCreate createSpec = new ClusterCreate();
    createSpec.setName(TEST_CLUSTER_NAME);
    createSpec.setType(ClusterType.HDFS_MAPRED);
    try {//from w w w.j  av  a  2 s .  co  m
        clusterMgr.createCluster(createSpec, new BaseConfiguration());
        Assert.assertTrue(false, "Cluster creation should throw exception.");
    } catch (Exception e) {
        e.printStackTrace();
        Assert.assertTrue(true, "got expected exception.");
    }
}

From source file:com.vmware.bdd.manager.TestClusteringJobs.java

@Test(groups = { "TestClusteringJobs" }, dependsOnMethods = { "testDupCreateCluster" })
@Transactional(propagation = Propagation.NEVER)
public void testStopCluster() throws Exception {
    long jobExecutionId = clusterMgr.stopCluster(TEST_CLUSTER_NAME);

    ClusterRead cluster = clusterEntityMgr.findClusterWithNodes(TEST_CLUSTER_NAME, false);
    Assert.assertTrue(cluster.getStatus() == ClusterStatus.STOPPING,
            "Cluster status should be STOPPING, but got " + cluster.getStatus());
    waitTaskFinished(jobExecutionId);//w ww . j av  a 2s  . com
    cluster = clusterEntityMgr.findClusterWithNodes(TEST_CLUSTER_NAME, false);
    Assert.assertTrue(cluster.getStatus() == ClusterStatus.STOPPED,
            "Cluster status should be STOPPED, but got " + cluster.getStatus());
    NodeRead node = cluster.getNodeGroups().get(0).getInstances().get(0);
    Assert.assertTrue(node.getStatus().equals(NodeStatus.POWERED_OFF.toString()),
            "Node " + node.getName() + " status should be Powered Off, but got " + node.getStatus());
}

From source file:com.vmware.bdd.manager.TestClusteringJobs.java

@Test(groups = { "TestClusteringJobs" }, dependsOnMethods = { "testStopCluster" })
@Transactional(propagation = Propagation.NEVER)
public void testDupStopCluster() throws Exception {
    try {//  w w  w.  ja v  a2  s .  com
        clusterMgr.stopCluster(TEST_CLUSTER_NAME);
        Assert.assertTrue(false, "Cluster stop should throw exception.");
    } catch (Exception e) {
        e.printStackTrace();
        Assert.assertTrue(true, "got expected exception.");
    }
    ClusterRead cluster = clusterMgr.getClusterByName(TEST_CLUSTER_NAME, false);
    Assert.assertTrue(cluster.getStatus() == ClusterStatus.STOPPED,
            "Cluster status should be STOPPED, but got " + cluster.getStatus());
}

From source file:com.vmware.bdd.manager.TestClusteringJobs.java

@Test(groups = { "TestClusteringJobs" }, dependsOnMethods = { "testDupStopCluster" })
@Transactional(propagation = Propagation.NEVER)
public void testStartCluster() throws Exception {
    long jobExecutionId = clusterMgr.startCluster(TEST_CLUSTER_NAME, false);

    ClusterRead cluster = clusterMgr.getClusterByName(TEST_CLUSTER_NAME, false);
    Assert.assertTrue(cluster.getStatus() == ClusterStatus.STARTING,
            "Cluster status should be STARTING, but got " + cluster.getStatus());
    waitTaskFinished(jobExecutionId);/*  w ww .ja v a  2s.  co  m*/
    cluster = clusterMgr.getClusterByName(TEST_CLUSTER_NAME, false);
    Assert.assertTrue(cluster.getStatus() == ClusterStatus.RUNNING,
            "Cluster status should be RUNNING, but got " + cluster.getStatus());
}

From source file:com.vmware.bdd.manager.TestClusteringJobs.java

@Test(groups = { "TestClusteringJobs" }, dependsOnMethods = { "testStartCluster" })
@Transactional(propagation = Propagation.NEVER)
public void testDupStartCluster() throws Exception {
    try {/*from  w  ww .  jav  a  2s  .c  o m*/
        clusterMgr.startCluster(TEST_CLUSTER_NAME, false);
        Assert.assertTrue(false, "Cluster start should throw exception.");
    } catch (Exception e) {
        e.printStackTrace();
        Assert.assertTrue(true, "got expected exception.");
    }
    ClusterRead cluster = clusterMgr.getClusterByName(TEST_CLUSTER_NAME, false);
    Assert.assertTrue(cluster.getStatus() == ClusterStatus.RUNNING,
            "Cluster status should be RUNNING, but got " + cluster.getStatus());
}

From source file:com.vmware.bdd.manager.TestClusteringJobs.java

@Test(groups = { "TestClusteringJobs" }, dependsOnMethods = { "testDupStartCluster" })
@Transactional(propagation = Propagation.NEVER)
public void testConfigIOShares() throws Exception {
    clusterMgr.prioritizeCluster(TEST_CLUSTER_NAME, Priority.HIGH);
    ClusterRead cluster = clusterMgr.getClusterByName(TEST_CLUSTER_NAME, false);
    Assert.assertTrue(cluster.getIoShares().equals(Priority.HIGH),
            "Cluster " + cluster.getName() + " should have HIGH io share level");
}