@Test void testUpdateResourceEntityTypeUnchanged() { String entityTypeId = "myEntityTypeId"; EntityType entityType = mock(EntityType.class); when(entityType.getLabel()).thenReturn("label"); when(entityType.getDescription()).thenReturn("description"); when(dataService.findOneById( EntityTypeMetadata.ENTITY_TYPE_META_DATA, entityTypeId, EntityType.class)) .thenReturn(entityType); Resource resource = Resource.builder() .setType(ResourceType.ENTITY_TYPE) .setId(entityTypeId) .setLabel("label") .setDescription("description") .build(); navigatorServiceImpl.updateResource(resource); verifyNoMoreInteractions(dataService); }
@Transactional @Override public void updateResource(Resource resource) { ResourceType resourceType = resource.getType(); switch (resourceType) { case PACKAGE: updatePackage(resource); break; case ENTITY_TYPE: case ENTITY_TYPE_ABSTRACT: updateEntityType(resource); break; default: throw new UnexpectedEnumException(resourceType); } }
NavigatorServiceImpl implements NavigatorService { @Transactional @Override public void updateResource(Resource resource) { ResourceType resourceType = resource.getType(); switch (resourceType) { case PACKAGE: updatePackage(resource); break; case ENTITY_TYPE: case ENTITY_TYPE_ABSTRACT: updateEntityType(resource); break; default: throw new UnexpectedEnumException(resourceType); } } }
NavigatorServiceImpl implements NavigatorService { @Transactional @Override public void updateResource(Resource resource) { ResourceType resourceType = resource.getType(); switch (resourceType) { case PACKAGE: updatePackage(resource); break; case ENTITY_TYPE: case ENTITY_TYPE_ABSTRACT: updateEntityType(resource); break; default: throw new UnexpectedEnumException(resourceType); } } NavigatorServiceImpl(
      DataService dataService,
      JobExecutor jobExecutor,
      ResourceDownloadJobExecutionFactory downloadJobExecutionFactory,
      ResourceCopyJobExecutionFactory copyJobExecutionFactory,
      ResourceDeleteJobExecutionFactory resourceDeleteJobExecutionFactory); }
NavigatorServiceImpl implements NavigatorService { @Transactional @Override public void updateResource(Resource resource) { ResourceType resourceType = resource.getType(); switch (resourceType) { case PACKAGE: updatePackage(resource); break; case ENTITY_TYPE: case ENTITY_TYPE_ABSTRACT: updateEntityType(resource); break; default: throw new UnexpectedEnumException(resourceType); } } NavigatorServiceImpl(
      DataService dataService,
      JobExecutor jobExecutor,
      ResourceDownloadJobExecutionFactory downloadJobExecutionFactory,
      ResourceCopyJobExecutionFactory copyJobExecutionFactory,
      ResourceDeleteJobExecutionFactory resourceDeleteJobExecutionFactory); @Transactional(readOnly = true) @Override @Nullable @CheckForNull Folder getFolder(@Nullable @CheckForNull String folderId); @Transactional(readOnly = true) @Override List<Resource> getResources(@Nullable @CheckForNull String folderId); @Transactional(readOnly = true) @Override List<Resource> findResources(String query); @Transactional @Override void moveResources(
      List<ResourceIdentifier> resources, @Nullable @CheckForNull String targetFolderId); @Override JobExecution copyResources(
      List<ResourceIdentifier> resources, @Nullable @CheckForNull String targetFolderId); @Override JobExecution downloadResources(List<ResourceIdentifier> resources); @Transactional @Override JobExecution deleteResources(List<ResourceIdentifier> resources); @Transactional @Override void updateResource(Resource resource); }
NavigatorServiceImpl implements NavigatorService { @Transactional @Override public void updateResource(Resource resource) { ResourceType resourceType = resource.getType(); switch (resourceType) { case PACKAGE: updatePackage(resource); break; case ENTITY_TYPE: case ENTITY_TYPE_ABSTRACT: updateEntityType(resource); break; default: throw new UnexpectedEnumException(resourceType); } } NavigatorServiceImpl(
      DataService dataService,
      JobExecutor jobExecutor,
      ResourceDownloadJobExecutionFactory downloadJobExecutionFactory,
      ResourceCopyJobExecutionFactory copyJobExecutionFactory,
      ResourceDeleteJobExecutionFactory resourceDeleteJobExecutionFactory); @Transactional(readOnly = true) @Override @Nullable @CheckForNull Folder getFolder(@Nullable @CheckForNull String folderId); @Transactional(readOnly = true) @Override List<Resource> getResources(@Nullable @CheckForNull String folderId); @Transactional(readOnly = true) @Override List<Resource> findResources(String query); @Transactional @Override void moveResources(
      List<ResourceIdentifier> resources, @Nullable @CheckForNull String targetFolderId); @Override JobExecution copyResources(
      List<ResourceIdentifier> resources, @Nullable @CheckForNull String targetFolderId); @Override JobExecution downloadResources(List<ResourceIdentifier> resources); @Transactional @Override JobExecution deleteResources(List<ResourceIdentifier> resources); @Transactional @Override void updateResource(Resource resource);  }