public Endpoint resolveEndpoint(String path) { checkNotNull(path,PATH_CANNOT_BE_NULL); return this.endpointRepository.endpointOfPath(path); }
@Override public void execute(EndpointRepository sut) { Endpoint result = sut.endpointOfPath(ep1.path()); System.out.println(result); } }
@Override public void execute(EndpointRepository sut) { Endpoint endpoint = sut.endpointOfPath(ep1.path()); endpoint.delete(deleted); } }
@Override public void execute(EndpointRepository sut) { Endpoint legacyEndpointByPath = sut.endpointOfPath(ep1.path()); debug("Retrieving endpoint by path {%s} : %s",ep1.path(),legacyEndpointByPath); Endpoint endpointByPath = sut.endpointOfPath(path); debug("Retrieving endpoint by path {%s} : %s",path,endpointByPath); Endpoint endpointByResource = sut.endpointOfResource(resource.id()); debug("Retrieving endpoint by resource {%s} : %s",resource.id(),endpointByResource); } }
private void publish(RootResource rootResource, Date creationDate) throws ApplicationConfigurationException { ResourceId resourceId = rootResource.resourceId(); String path = rootResource.path(); Resource prevResource = this.resourceRepository.resourceById(resourceId,Resource.class); Endpoint prevEndpoint = this.endpointRepository.endpointOfPath(path); if(prevEndpoint!=null && !prevEndpoint.resourceId().equals(resourceId)) { throw new ApplicationConfigurationException(String.format("Resource %s cannot be published at '%s' as that path is already in use by a resource %s",toString(resourceId),path,toString(prevEndpoint.resourceId()))); } if(prevEndpoint==null) { if(prevResource!=null) { throw new ApplicationConfigurationException(String.format("Resource %s cannot be published at '%s' as it is already published at '%s'",toString(resourceId),path,this.endpointRepository.endpointOfResource(resourceId).path())); } else { Resource resource=this.modelFactory.createResource(rootResource.template(),rootResource.name()); this.resourceRepository.add(resource); Endpoint endpoint=this.modelFactory.createEndpoint(path,resource,creationDate,EntityTag.createStrong(path)); this.endpointRepository.add(endpoint); } } }
@Override public void execute(EndpointRepository sut) { Endpoint endpointByPath = sut.endpointOfPath(ep1.path()); debug("Retrieving endpoint by path {%s} : %s",ep1.path(),endpointByPath); Endpoint endpointByResource = sut.endpointOfResource(resource.id()); debug("Retrieving endpoint by resource {%s} : %s",resource.id(),endpointByResource); } }