Enabled target.assignedDs load through action enitygraph.
Signed-off-by: Kai Zimmermann <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -710,8 +710,8 @@ public class DeploymentManagement {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link Action} entity for given actionId with all lazy
|
||||
* attributes.
|
||||
* Get the {@link Action} entity for given actionId with all lazy attributes
|
||||
* (i.e. distributionSet, target, target.assignedDs).
|
||||
*
|
||||
* @param actionId
|
||||
* to be id of the action
|
||||
|
||||
@@ -24,6 +24,7 @@ import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedAttributeNode;
|
||||
import javax.persistence.NamedEntityGraph;
|
||||
import javax.persistence.NamedEntityGraphs;
|
||||
import javax.persistence.NamedSubgraph;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
@@ -55,7 +56,7 @@ import org.eclipse.persistence.annotations.CascadeOnDelete;
|
||||
@Index(name = "sp_idx_action_prim", columnList = "tenant,id") })
|
||||
@NamedEntityGraphs({ @NamedEntityGraph(name = "Action.ds", attributeNodes = { @NamedAttributeNode("distributionSet") }),
|
||||
@NamedEntityGraph(name = "Action.all", attributeNodes = { @NamedAttributeNode("distributionSet"),
|
||||
@NamedAttributeNode("target") }) })
|
||||
@NamedAttributeNode(value = "target", subgraph = "target.ds") }, subgraphs = @NamedSubgraph(name = "target.ds", attributeNodes = @NamedAttributeNode("assignedDistributionSet") ) ) })
|
||||
@Entity
|
||||
public class Action extends BaseEntity implements Comparable<Action> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -66,6 +66,22 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
||||
@Autowired
|
||||
private EventBus eventBus;
|
||||
|
||||
@Test
|
||||
@Description("Test verifies that the repistory retrieves the action including all defined (lazy) details.")
|
||||
public void findActionWithLazyDetails() {
|
||||
final DistributionSet testDs = TestDataUtil.generateDistributionSet("TestDs", "1.0", softwareManagement,
|
||||
distributionSetManagement, new ArrayList<DistributionSetTag>());
|
||||
final List<Target> testTarget = targetManagement.createTargets(TestDataUtil.generateTargets(1));
|
||||
// one action with one action status is generated
|
||||
final Action action = deploymentManagement.findActionWithDetails(
|
||||
deploymentManagement.assignDistributionSet(testDs, testTarget).getActions().get(0));
|
||||
|
||||
assertThat(action.getDistributionSet()).as("DistributionSet in action").isNotNull();
|
||||
assertThat(action.getTarget()).as("Target in action").isNotNull();
|
||||
assertThat(action.getTarget().getAssignedDistributionSet()).as("AssignedDistributionSet of target in action")
|
||||
.isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Test verifies that the custom query to find all actions include the count of action status is working correctly")
|
||||
public void findActionsWithStatusCountByTarget() {
|
||||
|
||||
Reference in New Issue
Block a user