Merge pull request 'patch_#23400' (#6) from patch_#23400 into master
Reviewed-on: #6
This commit is contained in:
commit
47043b482c
|
@ -82,7 +82,7 @@ public class ConcessioniUtils {
|
|||
copied.getPianteFineScavo().add(clean(src.getPianteFineScavo().get(i)));
|
||||
copied=client.replace(copied);
|
||||
req=asCopyRequest(src.getPianteFineScavo().get(i),storage);
|
||||
req.setDestinationPath(Concessione.Paths.imgByIndex(i));
|
||||
req.setDestinationPath(Concessione.Paths.piantaByIndex(i));
|
||||
if(req.getStreams()!=null&&!req.getStreams().isEmpty())
|
||||
copied=client.registerFileSet(copied.getMongo_id(),req);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,9 @@ import java.nio.charset.Charset;
|
|||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.sun.corba.se.spi.orbutil.threadpool.Work;
|
||||
import org.bson.Document;
|
||||
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniFilters;
|
||||
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniModel;
|
||||
|
@ -113,10 +115,39 @@ public class StatelessClientTests extends BasicVreTests{
|
|||
Concessione c= prepare();
|
||||
Concessione copied = ConcessioniUtils.clone(client,c.getMongo_id());
|
||||
assertEquals(copied.getNome(),c.getNome());
|
||||
checkCopied(copied.getRelazioneScavo(),c.getRelazioneScavo());
|
||||
checkCopied(copied.getAbstractRelazione(),c.getAbstractRelazione());
|
||||
checkCopied(copied.getPosizionamentoScavo(),c.getPosizionamentoScavo());
|
||||
assertEquals(copied.getPianteFineScavo().size(),c.getPianteFineScavo().size());
|
||||
for(int i=0;i<c.getPianteFineScavo().size();i++)
|
||||
checkCopied(copied.getPianteFineScavo().get(i),c.getPianteFineScavo().get(i));
|
||||
assertEquals(copied.getImmaginiRappresentative().size(),c.getImmaginiRappresentative().size());
|
||||
for(int i=0;i<c.getImmaginiRappresentative().size();i++)
|
||||
checkCopied(copied.getImmaginiRappresentative().get(i),c.getImmaginiRappresentative().get(i));
|
||||
}
|
||||
|
||||
private static void checkCopied(AssociatedContent copied,AssociatedContent original){
|
||||
assertEquals(copied.getPolicy(),original.getPolicy());
|
||||
assertEquals(copied.getLicenseID(),original.getLicenseID());
|
||||
assertEquals(copied.getTitolo(),original.getTitolo());
|
||||
if(copied instanceof LayerConcessione){
|
||||
assertNull(((LayerConcessione)copied).getLayerName());
|
||||
assertNull(((LayerConcessione)copied).getLayerID());
|
||||
assertNull(((LayerConcessione)copied).getLayerUUID());
|
||||
assertNull(((LayerConcessione)copied).getWorkspace());
|
||||
assertNull(((LayerConcessione)copied).getWmsLink());
|
||||
}
|
||||
|
||||
if(original.getActualContent()!=null){
|
||||
assertNotNull(copied.getActualContent());
|
||||
// count only workspace content
|
||||
int oriringalCount= original.getActualContent().stream().
|
||||
filter(persistedContent -> persistedContent instanceof WorkspaceContent).
|
||||
collect(Collectors.toList()).size();
|
||||
|
||||
assertEquals(copied.getActualContent().size(),oriringalCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue