4740 |
05 Feb 09 |
nicklas |
1 |
/* |
4740 |
05 Feb 09 |
nicklas |
$Id$ |
4740 |
05 Feb 09 |
nicklas |
3 |
|
4740 |
05 Feb 09 |
nicklas |
Copyright (C) 2009 Nicklas Nordborg |
4740 |
05 Feb 09 |
nicklas |
5 |
|
4740 |
05 Feb 09 |
nicklas |
This file is part of BASE - BioArray Software Environment. |
4740 |
05 Feb 09 |
nicklas |
Available at http://base.thep.lu.se/ |
4740 |
05 Feb 09 |
nicklas |
8 |
|
4740 |
05 Feb 09 |
nicklas |
BASE is free software; you can redistribute it and/or |
4740 |
05 Feb 09 |
nicklas |
modify it under the terms of the GNU General Public License |
4740 |
05 Feb 09 |
nicklas |
as published by the Free Software Foundation; either version 3 |
4740 |
05 Feb 09 |
nicklas |
of the License, or (at your option) any later version. |
4740 |
05 Feb 09 |
nicklas |
13 |
|
4740 |
05 Feb 09 |
nicklas |
BASE is distributed in the hope that it will be useful, |
4740 |
05 Feb 09 |
nicklas |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
4740 |
05 Feb 09 |
nicklas |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4740 |
05 Feb 09 |
nicklas |
GNU General Public License for more details. |
4740 |
05 Feb 09 |
nicklas |
18 |
|
4740 |
05 Feb 09 |
nicklas |
You should have received a copy of the GNU General Public License |
4740 |
05 Feb 09 |
nicklas |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
4740 |
05 Feb 09 |
nicklas |
21 |
*/ |
4740 |
05 Feb 09 |
nicklas |
22 |
import java.util.List; |
4740 |
05 Feb 09 |
nicklas |
23 |
|
4740 |
05 Feb 09 |
nicklas |
24 |
import net.sf.basedb.core.BasicItem; |
4740 |
05 Feb 09 |
nicklas |
25 |
import net.sf.basedb.core.DataFileType; |
4740 |
05 Feb 09 |
nicklas |
26 |
import net.sf.basedb.core.DbControl; |
5685 |
04 Aug 11 |
nicklas |
27 |
import net.sf.basedb.core.DerivedBioAssay; |
5641 |
25 May 11 |
nicklas |
28 |
import net.sf.basedb.core.Extract; |
5630 |
13 May 11 |
nicklas |
29 |
import net.sf.basedb.core.Hardware; |
4740 |
05 Feb 09 |
nicklas |
30 |
import net.sf.basedb.core.Item; |
5642 |
26 May 11 |
nicklas |
31 |
import net.sf.basedb.core.PhysicalBioAssay; |
4740 |
05 Feb 09 |
nicklas |
32 |
import net.sf.basedb.core.Platform; |
5630 |
13 May 11 |
nicklas |
33 |
import net.sf.basedb.core.Protocol; |
4740 |
05 Feb 09 |
nicklas |
34 |
import net.sf.basedb.core.Quantity; |
4740 |
05 Feb 09 |
nicklas |
35 |
import net.sf.basedb.core.SessionControl; |
5630 |
13 May 11 |
nicklas |
36 |
import net.sf.basedb.core.Software; |
4740 |
05 Feb 09 |
nicklas |
37 |
import net.sf.basedb.core.SystemItems; |
4740 |
05 Feb 09 |
nicklas |
38 |
import net.sf.basedb.core.Type; |
4740 |
05 Feb 09 |
nicklas |
39 |
import net.sf.basedb.util.overview.Failure; |
4740 |
05 Feb 09 |
nicklas |
40 |
import net.sf.basedb.util.overview.GenericOverview; |
4740 |
05 Feb 09 |
nicklas |
41 |
import net.sf.basedb.util.overview.Node; |
4745 |
10 Feb 09 |
nicklas |
42 |
import net.sf.basedb.util.overview.OverviewUtil; |
4740 |
05 Feb 09 |
nicklas |
43 |
import net.sf.basedb.util.overview.loader.BasicItemNodeLoaderFactory; |
4740 |
05 Feb 09 |
nicklas |
44 |
|
4740 |
05 Feb 09 |
nicklas |
45 |
public class TestGenericOverview |
4740 |
05 Feb 09 |
nicklas |
46 |
{ |
4740 |
05 Feb 09 |
nicklas |
47 |
static boolean ok = true; |
4740 |
05 Feb 09 |
nicklas |
48 |
|
4740 |
05 Feb 09 |
nicklas |
49 |
public static void main(String[] args) |
4740 |
05 Feb 09 |
nicklas |
50 |
{ |
4740 |
05 Feb 09 |
nicklas |
51 |
TestUtil.checkArgs(args); |
4740 |
05 Feb 09 |
nicklas |
52 |
TestUtil.begin(); |
4740 |
05 Feb 09 |
nicklas |
53 |
ok = test_all(); |
4740 |
05 Feb 09 |
nicklas |
54 |
TestUtil.stop(); |
4740 |
05 Feb 09 |
nicklas |
55 |
} |
4740 |
05 Feb 09 |
nicklas |
56 |
|
4740 |
05 Feb 09 |
nicklas |
57 |
static boolean test_all() |
4740 |
05 Feb 09 |
nicklas |
58 |
{ |
4740 |
05 Feb 09 |
nicklas |
59 |
write("++Testing generic overview"); |
4740 |
05 Feb 09 |
nicklas |
// Create support items |
4740 |
05 Feb 09 |
nicklas |
// Annotation types |
4740 |
05 Feb 09 |
nicklas |
62 |
int annotationType = TestAnnotationType.test_create("Source", Type.STRING, 0, |
4743 |
09 Feb 09 |
nicklas |
63 |
null, null, Item.RAWBIOASSAY, 1, new String[] {"alfa", "beta"}, true); |
4740 |
05 Feb 09 |
nicklas |
64 |
|
4740 |
05 Feb 09 |
nicklas |
// Protocols |
4740 |
05 Feb 09 |
nicklas |
66 |
int scanningProtocol = TestProtocol.test_create( |
5630 |
13 May 11 |
nicklas |
67 |
SystemItems.getId(Protocol.SCANNING), "Scan protocol", false); |
5652 |
10 Jun 11 |
nicklas |
68 |
int sequencingProtocol = TestProtocol.test_create( |
5652 |
10 Jun 11 |
nicklas |
69 |
SystemItems.getId(Protocol.SEQUENCING), "Sequencing protocol", false); |
4740 |
05 Feb 09 |
nicklas |
70 |
int featureProtocol = TestProtocol.test_create( |
5630 |
13 May 11 |
nicklas |
71 |
SystemItems.getId(Protocol.FEATURE_EXTRACTION), "Feature protocol", false); |
4740 |
05 Feb 09 |
nicklas |
72 |
int power = SystemItems.getId(Quantity.POWER); |
4740 |
05 Feb 09 |
nicklas |
73 |
int milliWatt = TestUnit.test_load_by_symbol(power, "mW"); |
4740 |
05 Feb 09 |
nicklas |
74 |
int scanPower = TestAnnotationType.test_create("Power", Type.FLOAT, milliWatt, |
5685 |
04 Aug 11 |
nicklas |
75 |
null, null, Item.DERIVEDBIOASSAY, 1, null, false); |
4740 |
05 Feb 09 |
nicklas |
76 |
TestProtocol.test_set_protocol_parameter(scanningProtocol, scanPower); |
4740 |
05 Feb 09 |
nicklas |
77 |
|
4740 |
05 Feb 09 |
nicklas |
// Hardware and software |
4740 |
05 Feb 09 |
nicklas |
79 |
int scanner = TestHardware.test_create( |
5652 |
10 Jun 11 |
nicklas |
80 |
SystemItems.getId(Hardware.SCANNER), "Scanner GO", false); |
5652 |
10 Jun 11 |
nicklas |
81 |
int sequencer = TestHardware.test_create( |
5652 |
10 Jun 11 |
nicklas |
82 |
SystemItems.getId(Hardware.SEQUENCER), "Sequencer GO", false); |
4740 |
05 Feb 09 |
nicklas |
83 |
int software = TestSoftware.test_create( |
5652 |
10 Jun 11 |
nicklas |
84 |
SystemItems.getId(Software.FEATURE_EXTRACTION), "Feature extraction GO", false); |
5652 |
10 Jun 11 |
nicklas |
85 |
int alignmentSoftware = TestSoftware.test_create( |
5652 |
10 Jun 11 |
nicklas |
86 |
SystemItems.getId(Software.ALIGNMENT), "Alignment GO", false); |
4740 |
05 Feb 09 |
nicklas |
87 |
|
4740 |
05 Feb 09 |
nicklas |
// Data files |
4740 |
05 Feb 09 |
nicklas |
89 |
int genePixFile = TestFile.test_create("data/test.rawdata.import.txt", false, false); |
4740 |
05 Feb 09 |
nicklas |
90 |
int celFile = TestFile.test_create("data/test.affymetrix.cel", false, false); |
4740 |
05 Feb 09 |
nicklas |
91 |
int reporterMap = TestFile.test_create("data/test", false, false); |
5652 |
10 Jun 11 |
nicklas |
92 |
int samFile = TestFile.test_create("data/test.assembly.sam", false, false); |
4740 |
05 Feb 09 |
nicklas |
93 |
|
4740 |
05 Feb 09 |
nicklas |
// Create main items |
4740 |
05 Feb 09 |
nicklas |
95 |
|
4740 |
05 Feb 09 |
nicklas |
// Biomaterial |
4740 |
05 Feb 09 |
nicklas |
97 |
int biosource = TestBioSource.test_create("Test GO", false); |
6100 |
04 Sep 12 |
nicklas |
98 |
int sample1 = TestSample.test_create(biosource, "Sample GO #1", 0, false); |
6100 |
04 Sep 12 |
nicklas |
99 |
int sample2 = TestSample.test_create(biosource, "Sample GO #2", 0, false); |
5653 |
13 Jun 11 |
nicklas |
100 |
int extract1 = TestExtract.test_create(sample1, "Extract GO #1", 0, 0, false); |
5653 |
13 Jun 11 |
nicklas |
101 |
int extract2 = TestExtract.test_create(sample2, "Extract GO #2", 0, 0, false); |
5663 |
22 Jun 11 |
nicklas |
102 |
int extractPooled = TestExtract.test_create_pooled("Extract GO #3 (pooled)", extract1, extract2); |
4740 |
05 Feb 09 |
nicklas |
103 |
|
5652 |
10 Jun 11 |
nicklas |
// Array design |
5652 |
10 Jun 11 |
nicklas |
105 |
int arrayDesign = TestArrayDesign.test_create(Platform.GENERIC, false); |
5652 |
10 Jun 11 |
nicklas |
106 |
TestArrayDesign.test_set_file(arrayDesign, DataFileType.GENERIC_REPORTER_MAP, reporterMap); |
5652 |
10 Jun 11 |
nicklas |
107 |
|
5652 |
10 Jun 11 |
nicklas |
// Array batch & slide |
5652 |
10 Jun 11 |
nicklas |
109 |
int arrayBatch = TestArrayBatch.test_create(arrayDesign, false); |
5748 |
19 Sep 11 |
nicklas |
110 |
int arraySlide1 = TestArraySlide.test_create(arrayBatch, false); |
5748 |
19 Sep 11 |
nicklas |
111 |
int arraySlide2 = TestArraySlide.test_create(arrayBatch, false); |
5652 |
10 Jun 11 |
nicklas |
112 |
|
5652 |
10 Jun 11 |
nicklas |
// ******** Microarray part ******* |
5652 |
10 Jun 11 |
nicklas |
// Labeled extracts |
5632 |
17 May 11 |
nicklas |
115 |
int cy3 = TestTag.test_load("cy3"); |
5632 |
17 May 11 |
nicklas |
116 |
int cy5 = TestTag.test_load("cy5"); |
5641 |
25 May 11 |
nicklas |
117 |
int labeledExtract = SystemItems.getId(Extract.LABELED); |
5641 |
25 May 11 |
nicklas |
118 |
int labeledExtract1 = TestExtract.test_create(extract1, "Labeled GO #1 (cy3)", labeledExtract, cy3, false); |
5641 |
25 May 11 |
nicklas |
119 |
int labeledExtract2 = TestExtract.test_create(extract2, "Labeled GO #2 (cy3)", labeledExtract, cy3, false); |
5641 |
25 May 11 |
nicklas |
120 |
int labeledExtract1Ref = TestExtract.test_create(extractPooled, "Labeled GO #1 (cy5)", labeledExtract, cy5, false); |
5641 |
25 May 11 |
nicklas |
121 |
int labeledExtract2Ref = TestExtract.test_create(extractPooled, "Labeled GO #2 (cy5)", labeledExtract, cy5, false); |
4740 |
05 Feb 09 |
nicklas |
122 |
|
4740 |
05 Feb 09 |
nicklas |
// Hybridization |
5748 |
19 Sep 11 |
nicklas |
124 |
int hyb1 = TestPhysicalBioAssay.test_create(arraySlide1, "Hyb GO #1", SystemItems.getId(PhysicalBioAssay.HYBRIDIZATION), 1); |
5748 |
19 Sep 11 |
nicklas |
125 |
TestPhysicalBioAssay.test_add_extract(hyb1, labeledExtract1, 1, null); |
5748 |
19 Sep 11 |
nicklas |
126 |
TestPhysicalBioAssay.test_add_extract(hyb1, labeledExtract1Ref, 1, null); |
4740 |
05 Feb 09 |
nicklas |
127 |
|
5748 |
19 Sep 11 |
nicklas |
128 |
int hyb2 = TestPhysicalBioAssay.test_create(arraySlide2, "Hyb GO #2", SystemItems.getId(PhysicalBioAssay.HYBRIDIZATION), 1); |
5748 |
19 Sep 11 |
nicklas |
129 |
TestPhysicalBioAssay.test_add_extract(hyb2, labeledExtract2, 1, null); |
5748 |
19 Sep 11 |
nicklas |
130 |
TestPhysicalBioAssay.test_add_extract(hyb2, labeledExtract2Ref, 1, null); |
5748 |
19 Sep 11 |
nicklas |
131 |
|
4740 |
05 Feb 09 |
nicklas |
// Scan |
5748 |
19 Sep 11 |
nicklas |
133 |
int scan1 = TestDerivedBioAssay.test_create_root("Scan GO #1", hyb1, |
6100 |
04 Sep 12 |
nicklas |
134 |
SystemItems.getId(DerivedBioAssay.SCAN), 0, scanningProtocol, scanner, 0); |
5748 |
19 Sep 11 |
nicklas |
135 |
TestAnnotation.test_annotatate(Item.DERIVEDBIOASSAY, scan1, scanPower, 0, 15.0f); |
5748 |
19 Sep 11 |
nicklas |
136 |
int scan2 = TestDerivedBioAssay.test_create_root("Scan GO #2", hyb2, |
6100 |
04 Sep 12 |
nicklas |
137 |
SystemItems.getId(DerivedBioAssay.SCAN), 0, scanningProtocol, scanner, 0); |
5748 |
19 Sep 11 |
nicklas |
138 |
TestAnnotation.test_annotatate(Item.DERIVEDBIOASSAY, scan2, scanPower, 0, 15.0f); |
5748 |
19 Sep 11 |
nicklas |
139 |
|
4740 |
05 Feb 09 |
nicklas |
// Raw bioassay #1 |
5748 |
19 Sep 11 |
nicklas |
141 |
int rawBioAssay1 = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", "RBA #1", scan1, 0, software, featureProtocol, arrayDesign, false); |
5652 |
10 Jun 11 |
nicklas |
142 |
TestDataFileType.test_set_file(Item.RAWBIOASSAY, rawBioAssay1, DataFileType.GENERIC_RAW_DATA, genePixFile); |
5652 |
10 Jun 11 |
nicklas |
143 |
TestDataFileType.test_set_file(Item.RAWBIOASSAY, rawBioAssay1, DataFileType.AFFYMETRIX_CEL, celFile); |
4740 |
05 Feb 09 |
nicklas |
144 |
TestAnnotation.test_annotatate(Item.RAWBIOASSAY, rawBioAssay1, annotationType, 0, "alfa"); |
4740 |
05 Feb 09 |
nicklas |
145 |
|
4740 |
05 Feb 09 |
nicklas |
// Raw bioassay #2 |
5748 |
19 Sep 11 |
nicklas |
147 |
int rawBioAssay2 = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", "RBA #2", scan2, 0, software, featureProtocol, arrayDesign, false); |
5652 |
10 Jun 11 |
nicklas |
148 |
TestDataFileType.test_set_file(Item.RAWBIOASSAY, rawBioAssay2, DataFileType.GENERIC_RAW_DATA, genePixFile); |
4740 |
05 Feb 09 |
nicklas |
149 |
|
5652 |
10 Jun 11 |
nicklas |
// **** Sequencing part ******** |
5652 |
10 Jun 11 |
nicklas |
// Libraries |
5652 |
10 Jun 11 |
nicklas |
152 |
int library = SystemItems.getId(Extract.LIBRARY); |
5652 |
10 Jun 11 |
nicklas |
153 |
int library1 = TestExtract.test_create(extract1, "Library GO #1", library, 0, false); |
5652 |
10 Jun 11 |
nicklas |
154 |
int library2 = TestExtract.test_create(extract2, "Library GO #2", library, 0, false); |
5652 |
10 Jun 11 |
nicklas |
155 |
|
5652 |
10 Jun 11 |
nicklas |
// Flow cell |
5739 |
15 Sep 11 |
nicklas |
157 |
int flowCell = TestPhysicalBioAssay.test_create(0, "Flow cell GO #1", SystemItems.getId(PhysicalBioAssay.CLONAL_AMPLIFICATION), 2); |
5652 |
10 Jun 11 |
nicklas |
158 |
TestPhysicalBioAssay.test_add_extract(flowCell, library1, 1, null); |
5652 |
10 Jun 11 |
nicklas |
159 |
TestPhysicalBioAssay.test_add_extract(flowCell, library2, 2, null); |
5652 |
10 Jun 11 |
nicklas |
160 |
|
5652 |
10 Jun 11 |
nicklas |
// Sequencing |
5685 |
04 Aug 11 |
nicklas |
162 |
int sequencing = TestDerivedBioAssay.test_create_root("Sequenced GO", flowCell, |
6100 |
04 Sep 12 |
nicklas |
163 |
SystemItems.getId(DerivedBioAssay.SEQUENCES), 0, sequencingProtocol, sequencer, 0); |
5685 |
04 Aug 11 |
nicklas |
164 |
|
6100 |
04 Sep 12 |
nicklas |
165 |
int alignedAssayId1 = TestDerivedBioAssay.test_create_child("Aligned GO #1", library1, |
6100 |
04 Sep 12 |
nicklas |
166 |
SystemItems.getId(DerivedBioAssay.ARRANGEMENT), 0, 0, alignmentSoftware, sequencing); |
6100 |
04 Sep 12 |
nicklas |
167 |
int alignedAssayId2 = TestDerivedBioAssay.test_create_child("Aligned GO #2", library2, |
6100 |
04 Sep 12 |
nicklas |
168 |
SystemItems.getId(DerivedBioAssay.ARRANGEMENT), 0, 0, alignmentSoftware, sequencing); |
5652 |
10 Jun 11 |
nicklas |
169 |
TestDataFileType.test_set_file(Item.DERIVEDBIOASSAY, alignedAssayId1, DataFileType.SAM, samFile); |
5652 |
10 Jun 11 |
nicklas |
170 |
TestDataFileType.test_set_file(Item.DERIVEDBIOASSAY, alignedAssayId2, DataFileType.SAM, samFile); |
5652 |
10 Jun 11 |
nicklas |
171 |
|
5652 |
10 Jun 11 |
nicklas |
// Raw bioassays |
5748 |
19 Sep 11 |
nicklas |
173 |
int seqRaw1 = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", "SeqRBA #1", alignedAssayId1, library1, software, 0, arrayDesign, false); |
6100 |
04 Sep 12 |
nicklas |
174 |
int seqRaw2 = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", "SeqRBA #2", alignedAssayId2, library2, software, 0, arrayDesign, false); |
5652 |
10 Jun 11 |
nicklas |
175 |
|
5652 |
10 Jun 11 |
nicklas |
// **** Experiment ****** |
4740 |
05 Feb 09 |
nicklas |
177 |
int experiment = TestExperiment.test_create("genepix", false); |
5653 |
13 Jun 11 |
nicklas |
178 |
TestExperiment.test_add_rawbioassay(experiment, rawBioAssay1, rawBioAssay2, seqRaw1, seqRaw2); |
4740 |
05 Feb 09 |
nicklas |
179 |
TestExperiment.test_add_experimental_factors(experiment, scanPower, annotationType); |
4740 |
05 Feb 09 |
nicklas |
180 |
|
4740 |
05 Feb 09 |
nicklas |
// Show some overviews |
4740 |
05 Feb 09 |
nicklas |
182 |
test_overview(Item.BIOSOURCE, biosource); |
5748 |
19 Sep 11 |
nicklas |
183 |
test_overview(Item.PHYSICALBIOASSAY, hyb1); |
5748 |
19 Sep 11 |
nicklas |
184 |
test_overview(Item.PHYSICALBIOASSAY, flowCell); |
4740 |
05 Feb 09 |
nicklas |
185 |
test_overview(Item.ARRAYDESIGN, arrayDesign); |
4740 |
05 Feb 09 |
nicklas |
186 |
test_overview(Item.EXPERIMENT, experiment); |
4740 |
05 Feb 09 |
nicklas |
187 |
|
4740 |
05 Feb 09 |
nicklas |
// Delete items |
4740 |
05 Feb 09 |
nicklas |
189 |
if (TestUtil.waitBeforeDelete()) TestUtil.waitForEnter(); |
4740 |
05 Feb 09 |
nicklas |
// Main items |
4740 |
05 Feb 09 |
nicklas |
191 |
TestExperiment.test_delete(experiment); |
5652 |
10 Jun 11 |
nicklas |
192 |
|
5652 |
10 Jun 11 |
nicklas |
193 |
TestRawBioAssay.test_delete(seqRaw1); |
5652 |
10 Jun 11 |
nicklas |
194 |
TestRawBioAssay.test_delete(seqRaw2); |
5685 |
04 Aug 11 |
nicklas |
195 |
TestDerivedBioAssay.test_delete(alignedAssayId1); |
5685 |
04 Aug 11 |
nicklas |
196 |
TestDerivedBioAssay.test_delete(alignedAssayId2); |
5685 |
04 Aug 11 |
nicklas |
197 |
TestDerivedBioAssay.test_delete(sequencing); |
5652 |
10 Jun 11 |
nicklas |
198 |
TestPhysicalBioAssay.test_delete(flowCell); |
5652 |
10 Jun 11 |
nicklas |
199 |
TestExtract.test_delete(library1); |
5652 |
10 Jun 11 |
nicklas |
200 |
TestExtract.test_delete(library2); |
5652 |
10 Jun 11 |
nicklas |
201 |
|
4740 |
05 Feb 09 |
nicklas |
202 |
TestRawBioAssay.test_delete(rawBioAssay1); |
4740 |
05 Feb 09 |
nicklas |
203 |
TestRawBioAssay.test_delete(rawBioAssay2); |
5748 |
19 Sep 11 |
nicklas |
204 |
TestDerivedBioAssay.test_delete(scan1); |
5748 |
19 Sep 11 |
nicklas |
205 |
TestDerivedBioAssay.test_delete(scan2); |
5748 |
19 Sep 11 |
nicklas |
206 |
TestPhysicalBioAssay.test_delete(hyb1); |
5748 |
19 Sep 11 |
nicklas |
207 |
TestPhysicalBioAssay.test_delete(hyb2); |
5748 |
19 Sep 11 |
nicklas |
208 |
TestArraySlide.test_delete(arraySlide1); |
5748 |
19 Sep 11 |
nicklas |
209 |
TestArraySlide.test_delete(arraySlide2); |
4740 |
05 Feb 09 |
nicklas |
210 |
TestArrayBatch.test_delete(arrayBatch); |
4740 |
05 Feb 09 |
nicklas |
211 |
TestArrayDesign.test_delete(arrayDesign); |
5641 |
25 May 11 |
nicklas |
212 |
TestExtract.test_delete(labeledExtract1); |
5641 |
25 May 11 |
nicklas |
213 |
TestExtract.test_delete(labeledExtract1Ref); |
5641 |
25 May 11 |
nicklas |
214 |
TestExtract.test_delete(labeledExtract2); |
5641 |
25 May 11 |
nicklas |
215 |
TestExtract.test_delete(labeledExtract2Ref); |
5652 |
10 Jun 11 |
nicklas |
216 |
|
4740 |
05 Feb 09 |
nicklas |
217 |
TestExtract.test_delete(extractPooled); |
4740 |
05 Feb 09 |
nicklas |
218 |
TestExtract.test_delete(extract1); |
4740 |
05 Feb 09 |
nicklas |
219 |
TestExtract.test_delete(extract2); |
4740 |
05 Feb 09 |
nicklas |
220 |
TestSample.test_delete(sample1); |
4740 |
05 Feb 09 |
nicklas |
221 |
TestSample.test_delete(sample2); |
4740 |
05 Feb 09 |
nicklas |
222 |
TestBioSource.test_delete(biosource); |
4740 |
05 Feb 09 |
nicklas |
223 |
|
4740 |
05 Feb 09 |
nicklas |
// Support items |
4740 |
05 Feb 09 |
nicklas |
225 |
TestSoftware.test_delete(software); |
5652 |
10 Jun 11 |
nicklas |
226 |
TestSoftware.test_delete(alignmentSoftware); |
4740 |
05 Feb 09 |
nicklas |
227 |
TestHardware.test_delete(scanner); |
5652 |
10 Jun 11 |
nicklas |
228 |
TestHardware.test_delete(sequencer); |
4740 |
05 Feb 09 |
nicklas |
229 |
TestProtocol.test_delete(featureProtocol); |
4740 |
05 Feb 09 |
nicklas |
230 |
TestProtocol.test_delete(scanningProtocol); |
5652 |
10 Jun 11 |
nicklas |
231 |
TestProtocol.test_delete(sequencingProtocol); |
4740 |
05 Feb 09 |
nicklas |
232 |
TestFile.test_delete(celFile); |
4740 |
05 Feb 09 |
nicklas |
233 |
TestFile.test_delete(genePixFile); |
4740 |
05 Feb 09 |
nicklas |
234 |
TestFile.test_delete(reporterMap); |
5652 |
10 Jun 11 |
nicklas |
235 |
TestFile.test_delete(samFile); |
4740 |
05 Feb 09 |
nicklas |
236 |
TestAnnotationType.test_delete(scanPower); |
4740 |
05 Feb 09 |
nicklas |
237 |
TestAnnotationType.test_delete(annotationType); |
4740 |
05 Feb 09 |
nicklas |
238 |
|
4740 |
05 Feb 09 |
nicklas |
239 |
write("++Testing generic overview "+(ok ? "OK" : "Failed")+"\n"); |
4740 |
05 Feb 09 |
nicklas |
240 |
return ok; |
4740 |
05 Feb 09 |
nicklas |
241 |
} |
4740 |
05 Feb 09 |
nicklas |
242 |
|
4740 |
05 Feb 09 |
nicklas |
243 |
|
4740 |
05 Feb 09 |
nicklas |
244 |
|
4740 |
05 Feb 09 |
nicklas |
245 |
static void write(String message) |
4740 |
05 Feb 09 |
nicklas |
246 |
{ |
4740 |
05 Feb 09 |
nicklas |
247 |
System.out.println(message); |
4740 |
05 Feb 09 |
nicklas |
248 |
} |
4740 |
05 Feb 09 |
nicklas |
249 |
static void write(GenericOverview go) |
4740 |
05 Feb 09 |
nicklas |
250 |
{ |
4740 |
05 Feb 09 |
nicklas |
251 |
if (TestUtil.getSilent()) return; |
4740 |
05 Feb 09 |
nicklas |
252 |
write("--Generating overview..."); |
4740 |
05 Feb 09 |
nicklas |
253 |
write(go.getRootNode(), ""); |
4740 |
05 Feb 09 |
nicklas |
254 |
int i = 0; |
4740 |
05 Feb 09 |
nicklas |
255 |
for (Failure f : go.getFailures()) |
4740 |
05 Feb 09 |
nicklas |
256 |
{ |
4740 |
05 Feb 09 |
nicklas |
257 |
++i; |
4740 |
05 Feb 09 |
nicklas |
258 |
write("--failure " + i + ": " + f.getMessage() + " on node " + f.getNode().getTitle()); |
4740 |
05 Feb 09 |
nicklas |
259 |
} |
4740 |
05 Feb 09 |
nicklas |
260 |
} |
4740 |
05 Feb 09 |
nicklas |
261 |
static void write(Node node, String indent) |
4740 |
05 Feb 09 |
nicklas |
262 |
{ |
4740 |
05 Feb 09 |
nicklas |
263 |
write(" " + indent + node.getName() + ": " + node.getTitle()); |
4740 |
05 Feb 09 |
nicklas |
264 |
List<Node> children = node.getChildren(); |
4740 |
05 Feb 09 |
nicklas |
265 |
if (children != null) |
4740 |
05 Feb 09 |
nicklas |
266 |
{ |
4740 |
05 Feb 09 |
nicklas |
267 |
for (Node child : children) |
4740 |
05 Feb 09 |
nicklas |
268 |
{ |
4740 |
05 Feb 09 |
nicklas |
269 |
write(child, "".equals(indent) ? "|-" : "| " + indent); |
4740 |
05 Feb 09 |
nicklas |
270 |
} |
4740 |
05 Feb 09 |
nicklas |
271 |
} |
4740 |
05 Feb 09 |
nicklas |
272 |
} |
4740 |
05 Feb 09 |
nicklas |
273 |
|
4740 |
05 Feb 09 |
nicklas |
274 |
|
4740 |
05 Feb 09 |
nicklas |
275 |
static void test_overview(Item itemType, int id) |
4740 |
05 Feb 09 |
nicklas |
276 |
{ |
4740 |
05 Feb 09 |
nicklas |
277 |
if (id == 0) return; |
4740 |
05 Feb 09 |
nicklas |
278 |
DbControl dc = null; |
4740 |
05 Feb 09 |
nicklas |
279 |
SessionControl sc = TestUtil.getSessionControl(); |
4740 |
05 Feb 09 |
nicklas |
280 |
try |
4740 |
05 Feb 09 |
nicklas |
281 |
{ |
4740 |
05 Feb 09 |
nicklas |
282 |
dc = TestUtil.getDbControl(); |
4740 |
05 Feb 09 |
nicklas |
283 |
BasicItem item = itemType.getById(dc, id); |
4740 |
05 Feb 09 |
nicklas |
284 |
|
4767 |
17 Feb 09 |
nicklas |
285 |
GenericOverview go = OverviewUtil.getNewOverview(dc, item, null); |
4740 |
05 Feb 09 |
nicklas |
286 |
((BasicItemNodeLoaderFactory)go.getNodeLoaderFactory()).setUseNullLoaderIfNotFound(true); |
4768 |
18 Feb 09 |
nicklas |
287 |
go.expand(dc, go.getRootNode(), true); |
4740 |
05 Feb 09 |
nicklas |
288 |
write(go); |
4740 |
05 Feb 09 |
nicklas |
289 |
|
4740 |
05 Feb 09 |
nicklas |
290 |
write("--Load generic overview [root=" + item + "] OK"); |
4740 |
05 Feb 09 |
nicklas |
291 |
} |
4740 |
05 Feb 09 |
nicklas |
292 |
catch (Throwable ex) |
4740 |
05 Feb 09 |
nicklas |
293 |
{ |
4740 |
05 Feb 09 |
nicklas |
294 |
write("--Load generic overview [root =" + itemType + "(" + id + ") FAILED"); |
4740 |
05 Feb 09 |
nicklas |
295 |
ex.printStackTrace(); |
4740 |
05 Feb 09 |
nicklas |
296 |
ok = false; |
4740 |
05 Feb 09 |
nicklas |
297 |
} |
4740 |
05 Feb 09 |
nicklas |
298 |
finally |
4740 |
05 Feb 09 |
nicklas |
299 |
{ |
4740 |
05 Feb 09 |
nicklas |
300 |
if (dc != null) dc.close(); |
4740 |
05 Feb 09 |
nicklas |
301 |
} |
4740 |
05 Feb 09 |
nicklas |
302 |
} |
4740 |
05 Feb 09 |
nicklas |
303 |
|
4740 |
05 Feb 09 |
nicklas |
304 |
|
4740 |
05 Feb 09 |
nicklas |
305 |
|
4740 |
05 Feb 09 |
nicklas |
306 |
} |