{"action":"created","comment":{"url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/comments/84029272","pull_request_review_id":4831855,"id":84029272,"diff_hunk":"@@ -0,0 +1,652 @@\n+/*\n+ * Copyright (C) 2016 University of Dundee & Open Microscopy Environment.\n+ * All rights reserved.\n+ *\n+ * This program is free software; you can redistribute it and/or modify\n+ * it under the terms of the GNU General Public License as published by\n+ * the Free Software Foundation; either version 2 of the License, or\n+ * (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n+ * GNU General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU General Public License along\n+ * with this program; if not, write to the Free Software Foundation, Inc.,\n+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n+ */\n+\n+package integration;\n+\n+import java.util.Arrays;\n+import java.util.Random;\n+\n+import omero.ServerError;\n+import omero.api.IRenderingSettingsPrx;\n+import omero.model.Channel;\n+import omero.model.Dataset;\n+import omero.model.Folder;\n+import omero.model.Image;\n+import omero.model.ImportJob;\n+import omero.model.ImportJobI;\n+import omero.model.JobStatus;\n+import omero.model.LogicalChannel;\n+import omero.model.Namespace;\n+import omero.model.NamespaceI;\n+import omero.model.OriginalFile;\n+import omero.model.Pixels;\n+import omero.model.Plate;\n+import omero.model.PlateAcquisition;\n+import omero.model.Project;\n+import omero.model.Reagent;\n+import omero.model.RenderingDef;\n+import omero.model.Roi;\n+import omero.model.Screen;\n+import omero.model.StageLabel;\n+import omero.model.TagAnnotation;\n+import omero.model.TagAnnotationI;\n+import omero.model.Well;\n+import omero.sys.ParametersI;\n+\n+import org.testng.Assert;\n+import org.testng.annotations.BeforeMethod;\n+import org.testng.annotations.Test;\n+\n+import ome.api.JobHandle;\n+\n+public class ObjectPropertiesTest extends AbstractServerTest {\n+\n+    /**\n+     * Creates a name with length as a string\n+     * @param length length of the name to create in bytes\n+     * @return the name\n+     * @throws Exception unexpected\n+     */\n+    private String createName(int length) throws Exception {\n+        final Random rng = new Random();\n+        final char[] chars = new char[length];  // string length\n+        for (int i = 0; i < chars.length; i++) {\n+            chars[i] = (char) ('a' + rng.nextInt(26));\n+        }\n+        final String string = new String(chars);\n+        return string;\n+    }\n+\n+    /**\n+     * Sets up the testing user and group before each test\n+     * @throws Exception unexpected\n+     */\n+    @BeforeMethod\n+    private void createUserAndGroup() throws Exception {\n+        newUserAndGroup(\"rw----\");\n+    }\n+\n+    /**\n+     * Test to create a (tag) annotation and\n+     * save it with long name and long namespace\n+     * also has a negative test for names and namespaces >2KB\n+     * @throws Exception unexpected\n+     */\n+    @Test\n+    public void testAnnotationNameAndNsSaving() throws Exception {\n+\n+        /* Tag annotation is used here as a good representative\n+         * to test the annotations in general */\n+        final TagAnnotation ann = new TagAnnotationI();\n+\n+        /* for annotation name sizes of >2KB the test fails */\n+        /* createName() creates name with length in approx. bytes */\n+        String name = createName(1000000);\n+        ann.setName(omero.rtypes.rstring(name));\n+        try {\n+            iUpdate.saveAndReturnObject(ann);\n+            Assert.fail(\"Expected not to be able to insert \"\n+                      + \"tag names of size 1MB into the DB\");\n+        } catch (ServerError se) {\n+            /* expected */\n+        }\n+\n+        /* similarly, for annotation namespace sizes of >2KB the test fails */\n+        String namespace = createName(1000000);\n+        ann.setNs(omero.rtypes.rstring(namespace));\n+\n+        /* need to revert the name to 2KB size in order to be sure to test\n+         * for namespace failure, not both name and namespace failure */\n+        name = createName(2000);\n+        ann.setName(omero.rtypes.rstring(name));\n+        try {\n+            iUpdate.saveAndReturnObject(ann);\n+            Assert.fail(\"Expected not to be able to insert \"\n+                      + \"tag namespaces of size 1MB into the DB\");\n+        } catch (ServerError se) {\n+            /* expected */\n+        }\n+\n+        /* now set namespace with size 2KB (name was set to this size already above)\n+         * and let the test pass */\n+\n+        namespace = createName(2000);\n+        ann.setName(omero.rtypes.rstring(name));\n+        ann.setNs(omero.rtypes.rstring(namespace));;\n+        TagAnnotation sent = (TagAnnotation) iUpdate.saveAndReturnObject(ann);\n+        String savedName = sent.getName().getValue().toString();\n+        String savedNamespace = sent.getNs().getValue().toString();\n+        long id = sent.getId().getValue();\n+        final TagAnnotation retrievedAnnotation = (TagAnnotation) iQuery.get(\"TagAnnotation\", id);\n+        final String retrievedName = retrievedAnnotation.getName().getValue().toString();\n+        final String retrievedNamespace = retrievedAnnotation.getNs().getValue().toString();\n+        Assert.assertEquals(name, retrievedName);\n+        Assert.assertEquals(name, savedName);\n+        Assert.assertEquals(namespace, retrievedNamespace);\n+        Assert.assertEquals(namespace, savedNamespace);\n+    }\n+\n+    /**\n+     * Test to create a channel and save it with long lookup table\n+     * and test saving logical channel with long name.\n+     * @throws Exception unexpected\n+     */\n+    @Test\n+    public void testChannelLUTLogChannelName() throws Exception {\n+\n+        /* create some image which contains a\n+         * valid channel which contains a valid logical channel*/\n+        final Image img = mmFactory.createImage();\n+        final Image sentImage = (Image) iUpdate.saveAndReturnObject(img);\n+\n+        /* get the channel from the image and set\n+         * the lut of the channel and the name of the logical channel */\n+        final Channel ch = sentImage.getPrimaryPixels().getChannel(0);\n+        final String lut = createName(1000000);\n+        ch.setLookupTable(omero.rtypes.rstring(lut));\n+        final String logChannelName = createName(1000000);\n+        ch.getLogicalChannel().setName(omero.rtypes.rstring(logChannelName));\n+\n+        /* save the channel back and get the saved lut and logical channel name\n+         * and ids of channel and logical channel for later query*/\n+        Channel sent = (Channel) iUpdate.saveAndReturnObject(ch);\n+        String savedLut = sent.getLookupTable().getValue().toString();\n+        String savedLogChannelName = sent.getLogicalChannel().getName().getValue().toString();\n+        long id = sent.getId().getValue();\n+        long lChId = sent.getLogicalChannel().getId().getValue();\n+\n+        /* query the DB for the lut and logical channel name */\n+        final Channel retrievedChannel = (Channel) iQuery.get(\"Channel\", id);\n+        final LogicalChannel retrievedLogChannel = (LogicalChannel) iQuery.get(\"LogicalChannel\", lChId);\n+        final String retrievedLut = retrievedChannel.getLookupTable().getValue().toString();\n+        final String retrievedLogChannelName = retrievedLogChannel.getName().getValue().toString();\n+\n+        /* check that the originally created Lut, the saved lut,\n+         * and the lut retrieved by the query are the same. Do \n+         * a similar check for the logical channel name */\n+        Assert.assertEquals(lut, retrievedLut);\n+        Assert.assertEquals(lut, savedLut);\n+        Assert.assertEquals(logChannelName, retrievedLogChannelName);\n+        Assert.assertEquals(logChannelName, savedLogChannelName);\n+    }\n+\n+    /**\n+     * Test to create a dataset and save it with long name\n+     * @throws Exception unexpected\n+     */\n+    @Test\n+    public void testDatasetNameSaving() throws Exception {\n+        Dataset dat = mmFactory.simpleDataset();\n+        final String name = createName(1000000);\n+        dat.setName(omero.rtypes.rstring(name));\n+        Dataset sent = (Dataset) iUpdate.saveAndReturnObject(dat);\n+        String savedName = sent.getName().getValue().toString();\n+        long id = sent.getId().getValue();\n+        final Dataset retrievedDataset = (Dataset) iQuery.get(\"Dataset\", id);\n+        final String retrievedName = retrievedDataset.getName().getValue().toString();\n+        Assert.assertEquals(name, retrievedName);\n+        Assert.assertEquals(name, savedName);\n+    }\n+\n+    /**\n+     * Test to create a folder and save it with long name\n+     * @throws Exception unexpected\n+     */\n+    @Test\n+    public void testFolderNameSaving() throws Exception {\n+        Folder dat = mmFactory.simpleFolder();\n+        final String name = createName(1000000);\n+        dat.setName(omero.rtypes.rstring(name));\n+        Folder sent = (Folder) iUpdate.saveAndReturnObject(dat);\n+        String savedName = sent.getName().getValue().toString();\n+        long id = sent.getId().getValue();\n+        final Folder retrievedDataset = (Folder) iQuery.get(\"Folder\", id);\n+        final String retrievedName = retrievedDataset.getName().getValue().toString();\n+        Assert.assertEquals(name, retrievedName);\n+        Assert.assertEquals(name, savedName);\n+    }\n+\n+    /**\n+     * Test to create an image and save it with long name\n+     * @throws Exception unexpected\n+     */\n+    @Test\n+    public void testImageNameSaving() throws Exception {\n+        Image img = mmFactory.simpleImage();\n+        final String name = createName(1000000);\n+        img.setName(omero.rtypes.rstring(name));\n+        Image sent = (Image) iUpdate.saveAndReturnObject(img);\n+        String savedName = sent.getName().getValue().toString();\n+        long id = sent.getId().getValue();\n+        final Image retrievedImage = (Image) iQuery.get(\"Image\", id);\n+        final String retrievedName = retrievedImage.getName().getValue().toString();\n+        Assert.assertEquals(name, retrievedName);\n+        Assert.assertEquals(name, savedName);\n+    }\n+\n+    /**\n+     * Test to create a long import job image name\n+     * and a long import job image description and save these\n+     * @throws Exception unexpected\n+     */\n+    @Test\n+    public void testImportJobImageNameAndDescrSaving() throws Exception {\n+\n+        /*login as root in order to be able to create an ImportJob */\n+        logRootIntoGroup();\n+\n+        /* set up an ImportJob with all the compulsory parameters */\n+\n+        final ImportJob importJob = new ImportJobI();\n+        importJob.setGroupname(omero.rtypes.rstring(\"GroupName\"));\n+        importJob.setMessage(omero.rtypes.rstring(\"message\"));\n+        importJob.setScheduledFor(omero.rtypes.rtime(System.currentTimeMillis()));\n+        importJob.setStatus((JobStatus) factory.getTypesService().getEnumeration(JobStatus.class.getName(), JobHandle.FINISHED));\n+        importJob.setSubmitted(omero.rtypes.rtime(System.currentTimeMillis()));\n+        importJob.setType(omero.rtypes.rstring(\"Test\"));\n+        importJob.setUsername(omero.rtypes.rstring(\"username\"));\n+\n+        /* set a long name and a long description for the ImportJob */\n+        final String name = createName(1000000);\n+        importJob.setImageName(omero.rtypes.rstring(name));\n+        final String desc = createName(1000000);\n+        importJob.setImageDescription(omero.rtypes.rstring(desc));\n+\n+        /* save the ImmportJob and get the saved name, description \n+         * and id for later query */\n+\n+        ImportJob sent = (ImportJob) iUpdate.saveAndReturnObject(importJob);\n+        final String savedName = sent.getImageName().getValue().toString();\n+        final String savedDesc = sent.getImageDescription().getValue().toString();\n+        final long id = sent.getId().getValue();\n+        final ImportJob retrievedImportJob = (ImportJob) iQuery.get(\"ImportJob\", id);\n+        final String retrievedName = retrievedImportJob.getImageName().getValue().toString();\n+        final String retrievedDesc = retrievedImportJob.getImageDescription().getValue().toString();\n+        Assert.assertEquals(name, retrievedName);\n+        Assert.assertEquals(name, savedName);\n+        Assert.assertEquals(desc, retrievedDesc);\n+        Assert.assertEquals(desc, savedDesc);\n+    }\n+\n+    /**\n+     * Test to create a namespace and save it\n+     * with a long name and a long display name\n+     * also has negative tests for\n+     * namespace names and display names >2KB\n+     * @throws Exception unexpected\n+     */\n+    @Test\n+    public void testNamespaceNameAndDisplayName() throws Exception {\n+\n+        /*login as root in order to be able to create a Namespace */\n+        logRootIntoGroup();\n+        final Namespace ns = new NamespaceI();\n+\n+        /* for namespace name sizes of >2KB the test fails */\n+        /* createName() creates name with length in approx. bytes */\n+        String name = createName(1000000);\n+        ns.setName(omero.rtypes.rstring(name));\n+        try {\n+            iUpdate.saveAndReturnObject(ns);\n+            Assert.fail(\"Expected not to be able to insert \"\n+                      + \"namespace names of size 1MB into the DB\");\n+        } catch (ServerError se) {\n+            /* expected */\n+        }\n+\n+        /* similarly, for namespace display name sizes of >2KB the test fails */\n+        String displayName = createName(1000000);\n+        ns.setDisplayName(omero.rtypes.rstring(displayName));\n+\n+        /* need to revert the name to 2KB size in order to be sure to test\n+         * for displayName failure, not both name and displayName failure */\n+        name = createName(2000);\n+        try {\n+            iUpdate.saveAndReturnObject(ns);\n+            Assert.fail(\"Expected not to be able to insert \"\n+                      + \"namespace display names of size 1MB into the DB\");\n+        } catch (ServerError se) {\n+            /* expected */\n+        }\n+\n+        /* now set displayName with size 2KB (name was set to this size already above)\n+         * and let the test pass */\n+\n+        displayName = createName(2000);\n+        ns.setName(omero.rtypes.rstring(name));\n+        ns.setDisplayName(omero.rtypes.rstring(displayName));\n+        Namespace sent = (Namespace) iUpdate.saveAndReturnObject(ns);\n+        final String savedName = sent.getName().getValue().toString();\n+        final String savedDisplayName = sent.getDisplayName().getValue().toString();\n+        long id = sent.getId().getValue();\n+        final Namespace retrievedNamespace = (Namespace) iQuery.get(\"Namespace\", id);\n+        final String retrievedName = retrievedNamespace.getName().getValue().toString();\n+        final String retrievedDisplayName = retrievedNamespace.getDisplayName().getValue().toString();\n+        Assert.assertEquals(name, retrievedName);\n+        Assert.assertEquals(name, savedName);\n+        Assert.assertEquals(displayName, retrievedDisplayName);\n+        Assert.assertEquals(displayName, savedDisplayName);\n+    }\n+\n+    /**\n+     * Test to create an original file and save it\n+     * with long name and with long hash (2KB),\n+     * also has a negative test for hash >2KB\n+     * @throws Exception unexpected\n+     */\n+    @Test\n+    public void testOriginalFileNameAndHash() throws Exception {\n+        final OriginalFile oFile = mmFactory.createOriginalFile();\n+\n+        /* createName() creates name with length in approx. bytes */\n+        String name = createName(1000000);\n+        oFile.setName(omero.rtypes.rstring(name));\n+\n+        /* for original file hash sizes of >2KB the test fails */\n+        String hash = createName(1000000);\n+        oFile.setHash(omero.rtypes.rstring(hash));\n+        try {\n+            iUpdate.saveAndReturnObject(oFile);\n+            Assert.fail(\"Expected not to be able to insert \"\n+                      + \"original file hashes of size 1MB into the DB\");\n+        } catch (ServerError se) {\n+            /* expected */\n+        }\n+\n+        /* now set hash with size 2KB (name is fine at 1MB as set above)\n+         * and let the test pass */\n+\n+        hash = createName(2000);\n+        oFile.setName(omero.rtypes.rstring(name));\n+        oFile.setHash(omero.rtypes.rstring(hash));\n+        OriginalFile sent = (OriginalFile) iUpdate.saveAndReturnObject(oFile);\n+        String savedName = sent.getName().getValue().toString();\n+        String savedHash = sent.getHash().getValue().toString();\n+        long id = sent.getId().getValue();\n+        final OriginalFile retrievedOFile = (OriginalFile) iQuery.get(\"OriginalFile\", id);\n+        final String retrievedName = retrievedOFile.getName().getValue().toString();\n+        final String retrievedHash = retrievedOFile.getHash().getValue().toString();\n+        Assert.assertEquals(name, retrievedName);\n+        Assert.assertEquals(name, savedName);\n+        Assert.assertEquals(hash, retrievedHash);\n+        Assert.assertEquals(hash, savedHash);\n+    }\n+\n+    /**\n+     * Test to create a plate and save it with long name\n+     * and a long status and create plate acquisition and save it \n+     * with a long name\n+     * @throws Exception unexpected\n+     */\n+    @Test\n+    public void testPlateNameStatusAcquistitionName() throws Exception {\n+\n+        /* First test for plate name and status */\n+\n+        final Plate plate = mmFactory.createPlate(1, 1, 1, 1, false);\n+        final String name = createName(1000000);\n+        final String status = createName(1000000);\n+        plate.setName(omero.rtypes.rstring(name));\n+        plate.setStatus(omero.rtypes.rstring(status));\n+        Plate sentP = (Plate) iUpdate.saveAndReturnObject(plate);\n+        String savedName = sentP.getName().getValue().toString();\n+        String savedStatus = sentP.getStatus().getValue().toString();\n+        long idPlate = sentP.getId().getValue();\n+        final Plate retrievedPlate = (Plate) iQuery.get(\"Plate\", idPlate);\n+        final String retrievedName = retrievedPlate.getName().getValue().toString();\n+        final String retrievedStatus = retrievedPlate.getStatus().getValue().toString();\n+        Assert.assertEquals(name, retrievedName);\n+        Assert.assertEquals(name, savedName);\n+        Assert.assertEquals(status, retrievedStatus);\n+        Assert.assertEquals(status, savedStatus);\n+\n+        /* With the plate created in above test in hand\n+         * test for plate acquisition name.*/\n+\n+        final PlateAcquisition acquisition = (PlateAcquisition) iQuery.findByQuery(\"FROM PlateAcquisition WHERE plate.id = :id\", new ParametersI().addId(idPlate));\n+        final String acquisitionName = createName(1000000);\n+        acquisition.setName(omero.rtypes.rstring(acquisitionName));\n+        PlateAcquisition sentA = (PlateAcquisition) iUpdate.saveAndReturnObject(acquisition);\n+        String savedAcquisitionName = sentA.getName().getValue().toString();\n+        long idAcquisition = sentA.getId().getValue();\n+        final PlateAcquisition retrievedAcquisition = (PlateAcquisition) iQuery.get(\"PlateAcquisition\", idAcquisition);\n+        final String retrievedAcquisitionName = retrievedAcquisition.getName().getValue().toString();\n+        Assert.assertEquals(acquisitionName, retrievedAcquisitionName);\n+        Assert.assertEquals(acquisitionName, savedAcquisitionName);\n+    }\n+\n+    /**\n+     * Test to create a project and save it with long name\n+     * @throws Exception unexpected\n+     */\n+    @Test\n+    public void testProjectNameSaving() throws Exception {\n+        Project pro = mmFactory.simpleProject();\n+        final String name = createName(1000000);\n+        pro.setName(omero.rtypes.rstring(name));\n+        Project sent = (Project) iUpdate.saveAndReturnObject(pro);\n+        String savedName = sent.getName().getValue().toString();\n+        long id = sent.getId().getValue();\n+        final Project retrievedProject = (Project) iQuery.get(\"Project\", id);\n+        final String retrievedName = retrievedProject.getName().getValue().toString();\n+        Assert.assertEquals(name, retrievedName);\n+        Assert.assertEquals(name, savedName);\n+    }\n+\n+    /**\n+     * Test to create a reagent and save it with long name\n+     * @throws Exception unexpected\n+     */\n+    @Test\n+    public void testReagentNameSaving() throws Exception {\n+\n+        /* first need to create a screen, then a plate\n+         * with reagent and link it to the screen to \n+         * populate all necessary parameters of reagent\n+         */\n+\n+        Screen screen = mmFactory.simpleScreenData().asScreen();\n+        Reagent reagent = mmFactory.createReagent();\n+        screen.addReagent(reagent);\n+        Plate p = mmFactory.createPlateWithReagent(1, 1, 1, reagent);\n+        screen.linkPlate(p);\n+        Screen sentS = (Screen) iUpdate.saveAndReturnObject(screen);\n+        long screenId = sentS.getId().getValue();\n+\n+        /* now get the updated reagent back via a query */\n+        reagent = (Reagent) iQuery.findByQuery(\"FROM Reagent WHERE screen.id = :id\", \n+                new ParametersI().addId(screenId));\n+\n+        /* create a reagent name and set it on the retrieved reagent object */\n+\n+        final String name = createName(1000000);\n+        reagent.setName(omero.rtypes.rstring(name));\n+        Reagent sentR = (Reagent) iUpdate.saveAndReturnObject(reagent);\n+        String savedName = sentR.getName().getValue().toString();\n+        long id = sentR.getId().getValue();\n+        final Reagent retrievedReagent = (Reagent) iQuery.get(\"Reagent\", id);\n+        final String retrievedName = retrievedReagent.getName().getValue().toString();\n+        Assert.assertEquals(name, retrievedName);\n+        Assert.assertEquals(name, savedName);\n+    }\n+\n+    /**\n+     * Test to create a rendering definition and save it with long name\n+     * @throws Exception unexpected\n+     */\n+    @Test\n+    public void testRenderingDefinitionNameSaving() throws Exception {\n+\n+        /* first prepare image and pixels to get valid rendering defs */\n+        Image img = mmFactory.createImage();\n+        Image sentI = (Image) iUpdate.saveAndReturnObject(img);\n+        Pixels pixels = sentI.getPrimaryPixels();\n+\n+        /* now get the rendering defs back via a method and a query */\n+        IRenderingSettingsPrx prx = factory.getRenderingSettingsService();\n+        prx.setOriginalSettingsInSet(Pixels.class.getName(),\n+                Arrays.asList(pixels.getId().getValue()));\n+        final RenderingDef rDef = (RenderingDef) iQuery.findByQuery(\"select rdef from RenderingDef as rdef where rdef.pixels.id = :id\", \n+                new ParametersI().addId(pixels.getId().getValue()));","path":"components/tools/OmeroJava/test/integration/ObjectPropertiesTest.java","position":506,"original_position":506,"commit_id":"28c575456761e85176e09f5445271527b78cdbf1","original_commit_id":"28c575456761e85176e09f5445271527b78cdbf1","user":{"login":"mtbc","id":2630707,"avatar_url":"https://avatars.githubusercontent.com/u/2630707?v=3","gravatar_id":"","url":"https://api.github.com/users/mtbc","html_url":"https://github.com/mtbc","followers_url":"https://api.github.com/users/mtbc/followers","following_url":"https://api.github.com/users/mtbc/following{/other_user}","gists_url":"https://api.github.com/users/mtbc/gists{/gist_id}","starred_url":"https://api.github.com/users/mtbc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtbc/subscriptions","organizations_url":"https://api.github.com/users/mtbc/orgs","repos_url":"https://api.github.com/users/mtbc/repos","events_url":"https://api.github.com/users/mtbc/events{/privacy}","received_events_url":"https://api.github.com/users/mtbc/received_events","type":"User","site_admin":false},"body":"out of curiosity is it okay without the `.getValue()`?","created_at":"2016-10-19T09:22:44Z","updated_at":"2016-10-19T09:22:44Z","html_url":"https://github.com/openmicroscopy/openmicroscopy/pull/4897#discussion_r84029272","pull_request_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/4897","_links":{"self":{"href":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/comments/84029272"},"html":{"href":"https://github.com/openmicroscopy/openmicroscopy/pull/4897#discussion_r84029272"},"pull_request":{"href":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/4897"}}},"pull_request":{"url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/4897","id":89817182,"html_url":"https://github.com/openmicroscopy/openmicroscopy/pull/4897","diff_url":"https://github.com/openmicroscopy/openmicroscopy/pull/4897.diff","patch_url":"https://github.com/openmicroscopy/openmicroscopy/pull/4897.patch","issue_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/issues/4897","number":4897,"state":"open","locked":false,"title":"Unbounded length tests","user":{"login":"pwalczysko","id":2478303,"avatar_url":"https://avatars.githubusercontent.com/u/2478303?v=3","gravatar_id":"","url":"https://api.github.com/users/pwalczysko","html_url":"https://github.com/pwalczysko","followers_url":"https://api.github.com/users/pwalczysko/followers","following_url":"https://api.github.com/users/pwalczysko/following{/other_user}","gists_url":"https://api.github.com/users/pwalczysko/gists{/gist_id}","starred_url":"https://api.github.com/users/pwalczysko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pwalczysko/subscriptions","organizations_url":"https://api.github.com/users/pwalczysko/orgs","repos_url":"https://api.github.com/users/pwalczysko/repos","events_url":"https://api.github.com/users/pwalczysko/events{/privacy}","received_events_url":"https://api.github.com/users/pwalczysko/received_events","type":"User","site_admin":false},"body":"# What this PR does\r\nThis PR adds 25 tests for long (apparently unbound) name lengths saving in the DB. The tests go over the 25 model objects modified in https://github.com/openmicroscopy/openmicroscopy/pull/4882. The tests make sure the names of the lenght 1MB are saved and retrieved to and from the DB of the 25 objects (the list of the objects is taken from the description of https://github.com/openmicroscopy/openmicroscopy/pull/4882).\r\n\r\nNote that in cases where the fields in the DB are indexed, the test would fail with name lenghts of 1MB. Thus, the name lengths tested for was shortened in such cases to 2KB and negative tests were added for 1MB name lenghts for the relevant objects.\r\n\r\n# Testing this PR\r\n\r\nMake sure integration tests (java) are still passing. Look at the sensibility of the tests here.\r\n\r\n# Related reading\r\n\r\nhttps://github.com/openmicroscopy/openmicroscopy/pull/4882 and https://trello.com/c/ahSMgE9R/204-integration-tests-for-field-lengths?menu=filter&filter=@sebastienbesson","created_at":"2016-10-18T13:40:08Z","updated_at":"2016-10-19T09:22:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0d09c8522b2bc5a39b81ed503e65b1832542124d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/4897/commits","review_comments_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/4897/comments","review_comment_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/issues/4897/comments","statuses_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/statuses/28c575456761e85176e09f5445271527b78cdbf1","head":{"label":"pwalczysko:unbounded-length-tests","ref":"unbounded-length-tests","sha":"28c575456761e85176e09f5445271527b78cdbf1","user":{"login":"pwalczysko","id":2478303,"avatar_url":"https://avatars.githubusercontent.com/u/2478303?v=3","gravatar_id":"","url":"https://api.github.com/users/pwalczysko","html_url":"https://github.com/pwalczysko","followers_url":"https://api.github.com/users/pwalczysko/followers","following_url":"https://api.github.com/users/pwalczysko/following{/other_user}","gists_url":"https://api.github.com/users/pwalczysko/gists{/gist_id}","starred_url":"https://api.github.com/users/pwalczysko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pwalczysko/subscriptions","organizations_url":"https://api.github.com/users/pwalczysko/orgs","repos_url":"https://api.github.com/users/pwalczysko/repos","events_url":"https://api.github.com/users/pwalczysko/events{/privacy}","received_events_url":"https://api.github.com/users/pwalczysko/received_events","type":"User","site_admin":false},"repo":{"id":6058778,"name":"openmicroscopy","full_name":"pwalczysko/openmicroscopy","owner":{"login":"pwalczysko","id":2478303,"avatar_url":"https://avatars.githubusercontent.com/u/2478303?v=3","gravatar_id":"","url":"https://api.github.com/users/pwalczysko","html_url":"https://github.com/pwalczysko","followers_url":"https://api.github.com/users/pwalczysko/followers","following_url":"https://api.github.com/users/pwalczysko/following{/other_user}","gists_url":"https://api.github.com/users/pwalczysko/gists{/gist_id}","starred_url":"https://api.github.com/users/pwalczysko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pwalczysko/subscriptions","organizations_url":"https://api.github.com/users/pwalczysko/orgs","repos_url":"https://api.github.com/users/pwalczysko/repos","events_url":"https://api.github.com/users/pwalczysko/events{/privacy}","received_events_url":"https://api.github.com/users/pwalczysko/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pwalczysko/openmicroscopy","description":"OME (Open Microscopy Environment) develops open-source software and data format standards for the storage and manipulation of biological light microscopy data. A joint project between universities, research establishments and industry in Europe and the USA, OME has over 20 active researchers with strong links to the microscopy community. Funded by private and public research grants, OME has been a major force on the international microscopy stage since 2000.","fork":true,"url":"https://api.github.com/repos/pwalczysko/openmicroscopy","forks_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/forks","keys_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/teams","hooks_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/hooks","issue_events_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/issues/events{/number}","events_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/events","assignees_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/assignees{/user}","branches_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/branches{/branch}","tags_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/tags","blobs_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/git/refs{/sha}","trees_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/statuses/{sha}","languages_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/languages","stargazers_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/stargazers","contributors_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/contributors","subscribers_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/subscribers","subscription_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/subscription","commits_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/commits{/sha}","git_commits_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/git/commits{/sha}","comments_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/comments{/number}","issue_comment_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/issues/comments{/number}","contents_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/contents/{+path}","compare_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/merges","archive_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/downloads","issues_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/issues{/number}","pulls_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/pulls{/number}","milestones_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/milestones{/number}","notifications_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/labels{/name}","releases_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/releases{/id}","deployments_url":"https://api.github.com/repos/pwalczysko/openmicroscopy/deployments","created_at":"2012-10-03T11:03:38Z","updated_at":"2016-03-09T17:33:12Z","pushed_at":"2016-10-18T15:40:32Z","git_url":"git://github.com/pwalczysko/openmicroscopy.git","ssh_url":"git@github.com:pwalczysko/openmicroscopy.git","clone_url":"https://github.com/pwalczysko/openmicroscopy.git","svn_url":"https://github.com/pwalczysko/openmicroscopy","homepage":"http://www.openmicroscopy.org","size":2067574,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"openmicroscopy:develop","ref":"develop","sha":"c7df42964bf05a8bc6233e76ae8390862171ebbc","user":{"login":"openmicroscopy","id":975861,"avatar_url":"https://avatars.githubusercontent.com/u/975861?v=3","gravatar_id":"","url":"https://api.github.com/users/openmicroscopy","html_url":"https://github.com/openmicroscopy","followers_url":"https://api.github.com/users/openmicroscopy/followers","following_url":"https://api.github.com/users/openmicroscopy/following{/other_user}","gists_url":"https://api.github.com/users/openmicroscopy/gists{/gist_id}","starred_url":"https://api.github.com/users/openmicroscopy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmicroscopy/subscriptions","organizations_url":"https://api.github.com/users/openmicroscopy/orgs","repos_url":"https://api.github.com/users/openmicroscopy/repos","events_url":"https://api.github.com/users/openmicroscopy/events{/privacy}","received_events_url":"https://api.github.com/users/openmicroscopy/received_events","type":"Organization","site_admin":false},"repo":{"id":2228226,"name":"openmicroscopy","full_name":"openmicroscopy/openmicroscopy","owner":{"login":"openmicroscopy","id":975861,"avatar_url":"https://avatars.githubusercontent.com/u/975861?v=3","gravatar_id":"","url":"https://api.github.com/users/openmicroscopy","html_url":"https://github.com/openmicroscopy","followers_url":"https://api.github.com/users/openmicroscopy/followers","following_url":"https://api.github.com/users/openmicroscopy/following{/other_user}","gists_url":"https://api.github.com/users/openmicroscopy/gists{/gist_id}","starred_url":"https://api.github.com/users/openmicroscopy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmicroscopy/subscriptions","organizations_url":"https://api.github.com/users/openmicroscopy/orgs","repos_url":"https://api.github.com/users/openmicroscopy/repos","events_url":"https://api.github.com/users/openmicroscopy/events{/privacy}","received_events_url":"https://api.github.com/users/openmicroscopy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openmicroscopy/openmicroscopy","description":"OME (Open Microscopy Environment) develops open-source software and data format standards for the storage and manipulation of biological light microscopy data. A joint project between universities, research establishments and industry in Europe and the USA, OME has over 20 active researchers with strong links to the microscopy community. Funded by private and public research grants, OME has been a major force on the international microscopy stage since 2000.","fork":false,"url":"https://api.github.com/repos/openmicroscopy/openmicroscopy","forks_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/forks","keys_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/teams","hooks_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/hooks","issue_events_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/issues/events{/number}","events_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/events","assignees_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/assignees{/user}","branches_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/branches{/branch}","tags_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/tags","blobs_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/git/refs{/sha}","trees_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/statuses/{sha}","languages_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/languages","stargazers_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/stargazers","contributors_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/contributors","subscribers_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/subscribers","subscription_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/subscription","commits_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/commits{/sha}","git_commits_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/git/commits{/sha}","comments_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/comments{/number}","issue_comment_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/issues/comments{/number}","contents_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/contents/{+path}","compare_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/merges","archive_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/downloads","issues_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/issues{/number}","pulls_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls{/number}","milestones_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/milestones{/number}","notifications_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/labels{/name}","releases_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/releases{/id}","deployments_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/deployments","created_at":"2011-08-18T14:26:02Z","updated_at":"2016-10-15T04:27:03Z","pushed_at":"2016-10-19T09:21:00Z","git_url":"git://github.com/openmicroscopy/openmicroscopy.git","ssh_url":"git@github.com:openmicroscopy/openmicroscopy.git","clone_url":"https://github.com/openmicroscopy/openmicroscopy.git","svn_url":"https://github.com/openmicroscopy/openmicroscopy","homepage":"http://www.openmicroscopy.org","size":2122206,"stargazers_count":87,"watchers_count":87,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":77,"mirror_url":null,"open_issues_count":26,"forks":77,"open_issues":26,"watchers":87,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/4897"},"html":{"href":"https://github.com/openmicroscopy/openmicroscopy/pull/4897"},"issue":{"href":"https://api.github.com/repos/openmicroscopy/openmicroscopy/issues/4897"},"comments":{"href":"https://api.github.com/repos/openmicroscopy/openmicroscopy/issues/4897/comments"},"review_comments":{"href":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/4897/comments"},"review_comment":{"href":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/4897/commits"},"statuses":{"href":"https://api.github.com/repos/openmicroscopy/openmicroscopy/statuses/28c575456761e85176e09f5445271527b78cdbf1"}}}}
{"actor":{"display_login":"mtbc"}}