Skip to content

Commit

Permalink
Use name as a nodeId for ScheduledJob #10482
Browse files Browse the repository at this point in the history
  • Loading branch information
vbradnitski authored and rymsha committed Mar 26, 2024
1 parent 61906d4 commit 8f501fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ private ScheduledJob doExecute()
{
final PropertyTree data = SchedulerSerializer.toCreateNodeData( params );

final CreateNodeParams createNodeParams = CreateNodeParams.create().
setNodeId( new NodeId() ).
final CreateNodeParams createNodeParams = CreateNodeParams.create().setNodeId( NodeId.from( params.getName().getValue() ) ).
name( params.getName().getValue() ).
data( data ).
parent( NodePath.ROOT ).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import com.enonic.xp.impl.scheduler.SchedulerServiceImpl;
import com.enonic.xp.impl.scheduler.UpdateLastRunCommand;
import com.enonic.xp.node.NodeAccessException;
import com.enonic.xp.node.NodeAlreadyExistAtPathException;
import com.enonic.xp.node.NodeIdExistsException;
import com.enonic.xp.node.NodeNotFoundException;
import com.enonic.xp.page.DescriptorKey;
import com.enonic.xp.scheduler.CreateScheduledJobParams;
Expand Down Expand Up @@ -219,7 +219,7 @@ void createExisted()

adminContext().runWith( () -> schedulerService.create( params ) );

assertThrows( NodeAlreadyExistAtPathException.class, () -> adminContext().runWith( () -> schedulerService.create( params ) ) );
assertThrows( NodeIdExistsException.class, () -> adminContext().runWith( () -> schedulerService.create( params ) ) );
}

@Test
Expand Down

0 comments on commit 8f501fb

Please sign in to comment.