diff options
author | niamhcore <niamh.core@est.tech> | 2021-01-22 14:05:00 +0000 |
---|---|---|
committer | Rishi Chail <rishi.chail@est.tech> | 2021-01-25 12:30:27 +0000 |
commit | 1cef345e92ee93323b1220bac3ad3a90cb310406 (patch) | |
tree | e30bcda07f5cf2d3ab153ab676885a504f4ee246 /cps-ri | |
parent | a2f384de843c3c3f68d2d371d185c71a900e9810 (diff) |
Add DataNodeDoesNotExist Exception
Issue-ID: CPS-182
Signed-off-by: niamhcore <niamh.core@est.tech>
Change-Id: I05fdd0fbc207e4806c187b96d35d7b6c54b795ea
Diffstat (limited to 'cps-ri')
-rwxr-xr-x | cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepository.java | 4 | ||||
-rw-r--r-- | cps-ri/src/test/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceTest.java | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepository.java b/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepository.java index 6fc956c44d..bf551723f8 100755 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepository.java @@ -28,7 +28,7 @@ import org.checkerframework.checker.nullness.qual.NonNull; import org.onap.cps.spi.entities.AnchorEntity;
import org.onap.cps.spi.entities.DataspaceEntity;
import org.onap.cps.spi.entities.FragmentEntity;
-import org.onap.cps.spi.exceptions.NotFoundInDataspaceException;
+import org.onap.cps.spi.exceptions.DataNodeNotFoundException;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
@@ -44,7 +44,7 @@ public interface FragmentRepository extends JpaRepository<FragmentEntity, Long> default FragmentEntity getByDataspaceAndAnchorAndXpath(@NonNull DataspaceEntity dataspaceEntity,
@NonNull AnchorEntity anchorEntity, @NonNull String xpath) {
return findByDataspaceAndAnchorAndXpath(dataspaceEntity, anchorEntity, xpath)
- .orElseThrow(() -> new NotFoundInDataspaceException(dataspaceEntity.getName(), xpath));
+ .orElseThrow(() -> new DataNodeNotFoundException(dataspaceEntity.getName(), anchorEntity.getName(), xpath));
}
@Modifying
diff --git a/cps-ri/src/test/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceTest.java b/cps-ri/src/test/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceTest.java index de0942c3c3..4501e5f0ce 100644 --- a/cps-ri/src/test/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceTest.java +++ b/cps-ri/src/test/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceTest.java @@ -32,8 +32,8 @@ import org.onap.cps.DatabaseTestContainer; import org.onap.cps.spi.CpsDataPersistenceService; import org.onap.cps.spi.entities.FragmentEntity; import org.onap.cps.spi.exceptions.AnchorNotFoundException; +import org.onap.cps.spi.exceptions.DataNodeNotFoundException; import org.onap.cps.spi.exceptions.DataspaceNotFoundException; -import org.onap.cps.spi.exceptions.NotFoundInDataspaceException; import org.onap.cps.spi.model.DataNode; import org.onap.cps.spi.repository.FragmentRepository; import org.springframework.beans.factory.annotation.Autowired; @@ -159,7 +159,7 @@ public class CpsDataPersistenceServiceTest { .addChildDataNode(DATASPACE_NAME, ANCHOR_NAME1, PARENT_XPATH1, createDataNodeTree(CHILD_XPATH1)); } - @Test(expected = NotFoundInDataspaceException.class) + @Test(expected = DataNodeNotFoundException.class) @Sql({CLEAR_DATA, SET_DATA}) public void testAddAChildWithToAParentThatDoesNotExist() { cpsDataPersistenceService |