View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one   *
3    * or more contributor license agreements.  See the NOTICE file *
4    * distributed with this work for additional information        *
5    * regarding copyright ownership.  The ASF licenses this file   *
6    * to you under the Apache License, Version 2.0 (the            *
7    * "License"); you may not use this file except in compliance   *
8    * with the License.  You may obtain a copy of the License at   *
9    *                                                              *
10   *   http://www.apache.org/licenses/LICENSE-2.0                 *
11   *                                                              *
12   * Unless required by applicable law or agreed to in writing,   *
13   * software distributed under the License is distributed on an  *
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
15   * KIND, either express or implied.  See the License for the    *
16   * specific language governing permissions and limitations      *
17   * under the License.                                           *
18   */ 
19  package org.apache.rat.annotation;
20  
21  import org.apache.rat.test.utils.Resources;
22  import org.junit.Test;
23  
24  import java.io.BufferedReader;
25  import java.io.File;
26  import java.io.FileReader;
27  import java.io.FileWriter;
28  import java.io.IOException;
29  import java.io.Writer;
30  import java.util.Random;
31  
32  import static org.junit.Assert.assertEquals;
33  import static org.junit.Assert.assertFalse;
34  
35  public class TestLicenceAppender {
36      private static final String FIRST_LICENSE_LINE  = " Licensed to the Apache Software Foundation (ASF) under one";
37  
38      /** Used to ensure that temporary files have unq */
39      private Random random = new Random();
40  
41      private interface FileCreator {
42          void createFile(Writer w) throws IOException;
43      }
44  
45      private interface NewFileReader {
46          void readFile(BufferedReader r) throws IOException;
47      }
48  
49      private static String qualify(String fileName) {
50          return new File(new File(System.getProperty("java.io.tmpdir")),
51                          fileName)
52              .getAbsolutePath();
53      }
54  
55      private static void createTestFile(String fileName,
56                                         FileCreator creator)
57          throws IOException {
58          FileWriter w = null;
59          try {
60              creator.createFile(w = new FileWriter(fileName));
61          } finally {
62              if (w != null) {
63                  w.close();
64              }
65          }
66      }
67  
68      private static void tryToDelete(File f) {
69          if (f != null && f.exists() && !f.delete()) {
70              f.deleteOnExit();
71          }
72      }
73  
74      private static void commonTestTemplate(String relativeName,
75                                             FileCreator creator,
76                                             NewFileReader reader)
77          throws IOException {
78          String name = qualify(relativeName);
79          try {
80              createTestFile(name, creator);
81  
82              ApacheV2LicenceAppender appender =
83                  new ApacheV2LicenceAppender();
84              appender.append(new File(name));
85  
86              BufferedReader r = null;
87              try {
88                  r = new BufferedReader(new FileReader(name + ".new"));
89                  reader.readFile(r);
90              } finally {
91                  if (r != null) {
92                      r.close();
93                  }
94              }
95          } finally {
96              tryToDelete(new File(name));
97              tryToDelete(new File(name + ".new"));
98          }
99      }
100 
101     private static NewFileReader checkLines(final String firstLine,
102                                             final String secondLine) {
103         return new NewFileReader() {
104             public void readFile(BufferedReader r) throws IOException {
105                 String line = r.readLine();
106                 assertEquals("First line is incorrect",
107                              firstLine, line);
108                 if (secondLine != null) {
109                     line = r.readLine();
110                     assertEquals("Second line is incorrect",
111                                  secondLine, line);
112                 }
113             }
114         };
115     }
116 
117     private static NewFileReader checkLines(final String firstLine,
118                                             final String secondLine,
119                                             final String thirdLine) {
120         return new NewFileReader() {
121             public void readFile(BufferedReader r) throws IOException {
122                 String line = r.readLine();
123                 assertEquals("First line is incorrect",
124                              firstLine, line);
125                 if (secondLine != null) {
126                     line = r.readLine();
127                     assertEquals("Second line is incorrect",
128                                  secondLine, line);
129                 }
130                 if (thirdLine != null) {
131                     line = r.readLine();
132                     assertEquals("Third line is incorrect",
133                                  thirdLine, line);
134                 }
135             }
136         };
137     }
138 
139     @Test
140     public void addLicenceToUnknownFile() throws IOException {
141         String filename = qualify("tmp" + random.nextLong()
142                                   + ".unknownType");
143         File file = null;
144         File newFile = null;
145         try {
146             createTestFile(filename, new FileCreator() {
147                     public void createFile(Writer writer)
148                         throws IOException {
149                         writer.write("Unknown file type\n");
150                     }
151                 });
152 
153             file = new File(filename);
154             ApacheV2LicenceAppender appender =
155                 new ApacheV2LicenceAppender();
156             appender.append(file);
157 
158             newFile = new File(filename + ".new");
159             assertFalse("No new file should have been written",
160                         newFile.exists());
161         } finally {
162             tryToDelete(file);
163             tryToDelete(newFile);
164         }
165     }
166 
167     @Test
168     public void addLicenceToJava() throws IOException {
169         String filename = "tmp.java";
170         final String firstLine = "package foo;";
171         final String secondLine = "";
172         final String thirdLine = "/*";
173         commonTestTemplate(filename, new FileCreator() {
174                 public void createFile(Writer writer)
175                     throws IOException {
176                     writer.write(firstLine + "\n");
177                     writer.write("\n");
178                     writer.write("public class test {\n");
179                     writer.write("}\n");
180                 }
181             },
182             checkLines(firstLine, secondLine, thirdLine));
183     }
184 
185     @Test
186     public void addLicenceToJavaWithoutPackage() throws IOException {
187         String filename = "tmp.java";
188         String commentLine = "/*";
189         commonTestTemplate(filename, new FileCreator() {
190                 public void createFile(Writer writer)
191                     throws IOException {
192                     writer.write("public class test {\n");
193                     writer.write("}\n");
194                 }
195             },
196             checkLines(commentLine, null));
197     }
198 
199     @Test
200     public void addLicenceToXML() throws IOException {
201         String filename = "tmp.xml";
202         final String firstLine = "<?xml version='1.0'?>";
203         final String secondLine = "";
204         final String thirdLine = "<!--";
205 
206         commonTestTemplate(filename, new FileCreator() {
207                 public void createFile(Writer writer)
208                     throws IOException {
209                     writer.write(firstLine + "\n");
210                     writer.write("\n");
211                     writer.write("<xml>\n");
212                     writer.write("</xml>\n");
213                 }
214             },
215             checkLines(firstLine, secondLine, thirdLine));
216     }
217 
218     @Test
219     public void addLicenceToXMLWithoutDecl() throws IOException {
220         String filename = "tmp.xml";
221         final String firstLine = "<?xml version='1.0'?>";
222         final String secondLine = "<!--";
223 
224         commonTestTemplate(filename, new FileCreator() {
225                 public void createFile(Writer writer)
226                     throws IOException {
227                     writer.write("<xml>\n");
228                     writer.write("</xml>\n");
229                 }
230             },
231             checkLines(firstLine, secondLine));
232     }
233 
234     @Test
235     public void addLicenceToHTML() throws IOException {
236         String filename = "tmp.html";
237         String commentLine = "<!--";
238 
239         commonTestTemplate(filename, new FileCreator() {
240                 public void createFile(Writer writer)
241                     throws IOException {
242                     writer.write("<html>\n");
243                     writer.write("\n");
244                     writer.write("</html>\n");
245                 }
246             },
247             checkLines(commentLine, null));
248     }
249 
250     @Test
251     public void addLicenceToCSS() throws IOException {
252         String filename = "tmp.css";
253         String firstLine = "/*";
254 
255         commonTestTemplate(filename, new FileCreator() {
256                 public void createFile(Writer writer)
257                     throws IOException {
258                     writer.write(".class {\n");
259                     writer.write(" background-color: red;");
260                     writer.write("}\n");
261                 }
262             },
263             checkLines(firstLine, null));
264     }
265 
266     @Test
267     public void addLicenceToJavascript() throws IOException {
268         String filename = "tmp.js";
269         String firstLine = "/*";
270 
271         commonTestTemplate(filename, new FileCreator() {
272                 public void createFile(Writer writer)
273                     throws IOException {
274                     writer.write("if (a ==b) {>\n");
275                     writer.write(" alert(\"how useful!\");");
276                     writer.write("}\n");
277                 }
278             },
279             checkLines(firstLine, null));
280     }
281 
282     @Test
283     public void addLicenceToAPT() throws IOException {
284         String filename = "tmp.apt";
285         String firstLine = "~~" + FIRST_LICENSE_LINE;
286 
287         commonTestTemplate(filename, new FileCreator() {
288                 public void createFile(Writer writer)
289                     throws IOException {
290                     writer.write("A Simple APT file");
291                     writer.write(" This file contains nothing\n");
292                     writer.write(" of any importance\n");
293                 }
294             },
295             checkLines(firstLine, null));
296     }
297 
298     @Test
299     public void addLicenceToProperties() throws IOException {
300         String filename = "tmp.properties";
301         String firstLine = "#" + FIRST_LICENSE_LINE;
302 
303         commonTestTemplate(filename, new FileCreator() {
304                 public void createFile(Writer writer)
305                     throws IOException {
306                     writer.write("property = value\n");
307                     writer.write("fun = true\n");
308                     writer.write("cool = true\n");
309                 }
310             },
311             checkLines(firstLine, null));
312     }
313 
314     @Test
315     public void addLicenceToScala() throws IOException {
316         String filename = "tmp.scala";
317         final String firstLine = "package foo {";
318         final String newFirstLine = "/*";
319 
320         commonTestTemplate(filename, new FileCreator() {
321                 public void createFile(Writer writer)
322                     throws IOException {
323                     writer.write(firstLine + "\n");
324                     writer.write("\n");
325                     writer.write("    object X { val x = 1; }\n");
326                     writer.write("}\n");
327                 }
328             },
329             new NewFileReader() {
330                 public void readFile(BufferedReader reader)
331                     throws IOException {
332                     String line = reader.readLine();
333                     assertEquals("First line is incorrect",
334                                  newFirstLine, line);
335                     while ((line = reader.readLine()) != null) {
336                         if (line.length() == 0) {
337                             line = reader.readLine();
338                             break;
339                         }
340                     }
341                     assertEquals("Package line is incorrect",
342                                  firstLine, line);
343                 }
344             });
345     }
346 
347     @Test
348     public void addLicenseToRubyWithoutHashBang()
349         throws IOException {
350         String filename = "tmp.rb";
351         String firstLine = "#" + FIRST_LICENSE_LINE;
352 
353         commonTestTemplate(filename, new FileCreator() {
354                 public void createFile(Writer writer)
355                     throws IOException {
356                     writer.write("class Foo\n");
357                     writer.write("end\n");
358                 }
359             },
360             checkLines(firstLine, null));
361     }
362 
363     @Test
364     public void addLicenseToRubyWithHashBang() throws IOException {
365         String filename = "tmp.rb";
366         final String firstLine = "#!/usr/bin/env ruby";
367         String secondLine = "#" + FIRST_LICENSE_LINE;
368 
369         commonTestTemplate(filename, new FileCreator() {
370                 public void createFile(Writer writer)
371                     throws IOException {
372                     writer.write(firstLine + "\n");
373                     writer.write("class Foo\n");
374                     writer.write("end\n");
375                 }
376             },
377             checkLines(firstLine, secondLine));
378     }
379 
380     @Test
381     public void addLicenseToPerlWithoutHashBang()
382         throws IOException {
383         String filename = "tmp.pl";
384         String firstLine = "#" + FIRST_LICENSE_LINE;
385 
386         commonTestTemplate(filename, new FileCreator() {
387                 public void createFile(Writer writer)
388                     throws IOException {
389                     writer.write("print \"Hello world\"\n");
390                 }
391             },
392             checkLines(firstLine, null));
393     }
394 
395     @Test
396     public void addLicenseToPerlWithHashBang() throws IOException {
397         String filename = "tmp.pl";
398         final String firstLine = "#!/usr/bin/env perl";
399         String secondLine = "#" + FIRST_LICENSE_LINE;
400 
401         commonTestTemplate(filename, new FileCreator() {
402                 public void createFile(Writer writer)
403                     throws IOException {
404                     writer.write(firstLine + "\n");
405                     writer.write("print \"Hello world\"\n");
406                 }
407             },
408             checkLines(firstLine, secondLine));
409     }
410 
411     @Test
412     public void addLicenseToTclWithoutHashBang()
413         throws IOException {
414         String filename = "tmp.tcl";
415         String firstLine = "#" + FIRST_LICENSE_LINE;
416 
417         commonTestTemplate(filename, new FileCreator() {
418                 public void createFile(Writer writer)
419                     throws IOException {
420                     writer.write("puts \"Hello world\"\n");
421                 }
422             },
423             checkLines(firstLine, null));
424     }
425 
426     @Test
427     public void addLicenseToTclWithHashBang() throws IOException {
428         String filename = "tmp.tcl";
429         final String firstLine = "#!/usr/bin/env tcl";
430         String secondLine = "#" + FIRST_LICENSE_LINE;
431 
432         commonTestTemplate(filename, new FileCreator() {
433                 public void createFile(Writer writer)
434                     throws IOException {
435                     writer.write(firstLine + "\n");
436                     writer.write("puts \"Hello world\"\n");
437                 }
438             },
439             checkLines(firstLine, secondLine));
440     }
441 
442     @Test
443     public void addLicenceToPHP() throws IOException {
444         String filename = "tmp.php";
445         final String firstLine = "<?php";
446         final String secondLine = "";
447         final String thirdLine = "/*";
448 
449         commonTestTemplate(filename, new FileCreator() {
450                 public void createFile(Writer writer)
451                     throws IOException {
452                     writer.write(firstLine + "\n");
453                     writer.write("echo 'Hello World'\n");
454                     writer.write("?>\n");
455                 }
456             },
457             checkLines(firstLine, secondLine, thirdLine));
458     }
459 
460     @Test
461     public void addLicenceToCSharp() throws IOException {
462         String filename = "tmp.cs";
463         String firstLine = "/*";
464 
465         commonTestTemplate(filename, new FileCreator() {
466                 public void createFile(Writer writer)
467                     throws IOException {
468                     writer.write("namespace org.example {\n");
469                     writer.write("    public class Foo {\n");
470                     writer.write("    }\n");
471                     writer.write("}\n");
472                 }
473             },
474             checkLines(firstLine, null));
475     }
476 
477     @Test
478     public void addLicenceToGroovy() throws IOException {
479         String filename = "tmp.groovy";
480         String firstLine = "/*";
481 
482         commonTestTemplate(filename, new FileCreator() {
483                 public void createFile(Writer writer)
484                     throws IOException {
485                     writer.write("package org.example \n");
486                     writer.write("    class Foo {\n");
487                     writer.write("    }\n");
488                 }
489             },
490             checkLines(firstLine, null));
491     }
492 
493     @Test
494     public void addLicenceToCPlusPlus() throws IOException {
495         String filename = "tmp.cpp";
496         String firstLine = "/*";
497 
498         commonTestTemplate(filename, new FileCreator() {
499                 public void createFile(Writer writer)
500                     throws IOException {
501                     writer.write("namespace org.example {\n");
502                     writer.write("    public class Foo {\n");
503                     writer.write("    }\n");
504                     writer.write("}\n");
505                 }
506             },
507             checkLines(firstLine, null));
508     }
509 
510     @Test
511     public void fileWithBOM() throws IOException {
512         File f = Resources.getResourceFile("violations/FilterTest.cs");
513         try {
514             ApacheV2LicenceAppender appender =
515                 new ApacheV2LicenceAppender();
516             appender.append(f);
517 
518             BufferedReader r = null;
519             try {
520                 r = new BufferedReader(new FileReader(f.getAbsolutePath()
521                                                       + ".new"));
522                 assertEquals("/*", r.readLine());
523                 String line = null;
524                 while ((line = r.readLine()) != null) {
525                     if (line.trim().length() == 0) {
526                         break;
527                     }
528                 }
529                 assertEquals("#if NET_2_0", r.readLine());
530             } finally {
531                 if (r != null) {
532                     r.close();
533                 }
534             }
535         } finally {
536             tryToDelete(new File(f.getAbsolutePath() + ".new"));
537         }
538     }
539 
540     @Test
541     public void addLicenceToVS2003solution() throws IOException {
542         String filename = "tmp.sln";
543         final String firstLine = "Microsoft Visual Studio Solution File,"
544             + " Format Version 8.0";
545         String secondLine = "#" + FIRST_LICENSE_LINE;
546 
547         commonTestTemplate(filename, new FileCreator() {
548                 public void createFile(Writer writer)
549                     throws IOException {
550                     writer.write(firstLine + "\n");
551                     writer.write("Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp\", \"Tutorials\\ConsoleApp\\cs\\src\\ConsoleApp.csproj\", \"{933969DF-2BC5-44E6-8B1A-400FC276A23F}\"\n");
552                     writer.write("\tProjectSection(WebsiteProperties) = preProject\n");
553                     writer.write("\t\tDebug.AspNetCompiler.Debug = \"True\"\n");
554                     writer.write("\t\tRelease.AspNetCompiler.Debug = \"False\"\n");
555                     writer.write("\tEndProjectSection\n");
556                     writer.write("EndProject\n");
557                 }
558             },
559             checkLines(firstLine, secondLine));
560     }
561 
562     @Test
563     public void addLicenceToVS2005solution() throws IOException {
564         String filename = "tmp.sln";
565         final String firstLine = "Microsoft Visual Studio Solution File,"
566             + " Format Version 9.0";
567         final String secondLine = "# Visual Studio 2005";
568         final String thirdLine = "#" + FIRST_LICENSE_LINE;
569 
570         commonTestTemplate(filename, new FileCreator() {
571                 public void createFile(Writer writer)
572                     throws IOException {
573                     writer.write(firstLine + "\n");
574                     writer.write(secondLine + "\n");
575                     writer.write("Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp\", \"Tutorials\\ConsoleApp\\cs\\src\\ConsoleApp.csproj\", \"{933969DF-2BC5-44E6-8B1A-400FC276A23F}\"\n");
576                     writer.write("\tProjectSection(WebsiteProperties) = preProject\n");
577                     writer.write("\t\tDebug.AspNetCompiler.Debug = \"True\"\n");
578                     writer.write("\t\tRelease.AspNetCompiler.Debug = \"False\"\n");
579                     writer.write("\tEndProjectSection\n");
580                     writer.write("EndProject\n");
581                 }
582             },
583             new NewFileReader() {
584                 public void readFile(BufferedReader r) throws IOException {
585                     String line = r.readLine();
586                     assertEquals("First line is incorrect",
587                                  firstLine, line);
588                     line = r.readLine();
589                     assertEquals("Second line is incorrect",
590                                  secondLine, line);
591                     line = r.readLine();
592                     assertEquals("Third line is incorrect",
593                                  thirdLine, line);
594                 }
595             });
596     }
597 
598     @Test
599     public void addLicenceToVS2010ExpressSolution() throws IOException {
600         String filename = "tmp.sln";
601         final String firstLine = "Microsoft Visual Studio Solution File, "
602             + "Format Version 11.00";
603         final String secondLine = "# Visual C# Express 2010";
604         final String thirdLine = "#" + FIRST_LICENSE_LINE;
605 
606         commonTestTemplate(filename, new FileCreator() {
607                 public void createFile(Writer writer)
608                     throws IOException {
609                     writer.write(firstLine + "\n");
610                     writer.write(secondLine + "\n");
611                     writer.write("Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Lucene.Net\", \"..\\..\\..\\src\\core\\Lucene.Net.csproj\", \"{5D4AD9BE-1FFB-41AB-9943-25737971BF57}\"\n");
612                     writer.write("EndProject\n");
613                     writer.write("Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Contrib.Highlighter\", \"..\\..\\..\\src\\contrib\\Highlighter\\Contrib.Highlighter.csproj\", \"{901D5415-383C-4AA6-A256-879558841BEA}\"\n");
614                     writer.write("EndProject\n");
615                     writer.write("Global\n");
616                     writer.write("GlobalSection(SolutionConfigurationPlatforms) = preSolution\n");
617                     writer.write("Debug|Any CPU = Debug|Any CPU\n");
618                     writer.write("Release|Any CPU = Release|Any CPU\n");
619                     writer.write("EndGlobalSection\n");
620                     writer.write("GlobalSection(ProjectConfigurationPlatforms) = postSolution\n");
621                     writer.write("{5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n");
622                     writer.write("{5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Debug|Any CPU.Build.0 = Debug|Any CPU\n");
623                     writer.write("{5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Release|Any CPU.ActiveCfg = Release|Any CPU\n");
624                     writer.write("{5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Release|Any CPU.Build.0 = Release|Any CPU\n");
625                     writer.write("{901D5415-383C-4AA6-A256-879558841BEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n");
626                     writer.write("{901D5415-383C-4AA6-A256-879558841BEA}.Debug|Any CPU.Build.0 = Debug|Any CPU\n");
627                     writer.write("{901D5415-383C-4AA6-A256-879558841BEA}.Release|Any CPU.ActiveCfg = Release|Any CPU\n");
628                     writer.write("{901D5415-383C-4AA6-A256-879558841BEA}.Release|Any CPU.Build.0 = Release|Any CPU\n");
629                     writer.write("EndGlobalSection\n");
630                     writer.write("GlobalSection(SolutionProperties) = preSolution\n");
631                     writer.write("HideSolutionNode = FALSE\n");
632                     writer.write("EndGlobalSection\n");
633                     writer.write("EndGlobal \n");
634                 }
635             },
636             new NewFileReader() {
637                 public void readFile(BufferedReader r) throws IOException {
638                     String line = r.readLine();
639                     assertEquals("First line is incorrect",
640                                  firstLine, line);
641                     line = r.readLine();
642                     assertEquals("Second line is incorrect",
643                                  secondLine, line);
644                     line = r.readLine();
645                     assertEquals("Third line is incorrect",
646                                  thirdLine, line);
647                 }
648             });
649     }
650 
651     @Test
652     public void addLicenceToVS2010SolutionWithBlankLine() throws IOException {
653         String filename = "tmp.sln";
654         final String firstLine = "";
655         final String secondLine = "Microsoft Visual Studio Solution File, "
656             + "Format Version 11.00";
657         final String thirdLine = "# Visual C# Express 2010";
658         final String forthLine = "#" + FIRST_LICENSE_LINE;
659 
660         commonTestTemplate(filename, new FileCreator() {
661                 public void createFile(Writer writer)
662                     throws IOException {
663                     writer.write(firstLine + "\n");
664                     writer.write(secondLine + "\n");
665                     writer.write(thirdLine + "\n");
666                     writer.write("Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Lucene.Net\", \"..\\..\\..\\src\\core\\Lucene.Net.csproj\", \"{5D4AD9BE-1FFB-41AB-9943-25737971BF57}\"\n");
667                     writer.write("EndProject\n");
668                     writer.write("Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Contrib.Highlighter\", \"..\\..\\..\\src\\contrib\\Highlighter\\Contrib.Highlighter.csproj\", \"{901D5415-383C-4AA6-A256-879558841BEA}\"\n");
669                     writer.write("EndProject\n");
670                     writer.write("Global\n");
671                     writer.write("GlobalSection(SolutionConfigurationPlatforms) = preSolution\n");
672                     writer.write("Debug|Any CPU = Debug|Any CPU\n");
673                     writer.write("Release|Any CPU = Release|Any CPU\n");
674                     writer.write("EndGlobalSection\n");
675                     writer.write("GlobalSection(ProjectConfigurationPlatforms) = postSolution\n");
676                     writer.write("{5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n");
677                     writer.write("{5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Debug|Any CPU.Build.0 = Debug|Any CPU\n");
678                     writer.write("{5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Release|Any CPU.ActiveCfg = Release|Any CPU\n");
679                     writer.write("{5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Release|Any CPU.Build.0 = Release|Any CPU\n");
680                     writer.write("{901D5415-383C-4AA6-A256-879558841BEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n");
681                     writer.write("{901D5415-383C-4AA6-A256-879558841BEA}.Debug|Any CPU.Build.0 = Debug|Any CPU\n");
682                     writer.write("{901D5415-383C-4AA6-A256-879558841BEA}.Release|Any CPU.ActiveCfg = Release|Any CPU\n");
683                     writer.write("{901D5415-383C-4AA6-A256-879558841BEA}.Release|Any CPU.Build.0 = Release|Any CPU\n");
684                     writer.write("EndGlobalSection\n");
685                     writer.write("GlobalSection(SolutionProperties) = preSolution\n");
686                     writer.write("HideSolutionNode = FALSE\n");
687                     writer.write("EndGlobalSection\n");
688                     writer.write("EndGlobal \n");
689                 }
690             },
691             new NewFileReader() {
692                 public void readFile(BufferedReader r) throws IOException {
693                     String line = r.readLine();
694                     assertEquals("First line is incorrect",
695                                  firstLine, line);
696                     line = r.readLine();
697                     assertEquals("Second line is incorrect",
698                                  secondLine, line);
699                     line = r.readLine();
700                     assertEquals("Third line is incorrect",
701                                  thirdLine, line);
702                     line = r.readLine();
703                     assertEquals("Forth line is incorrect",
704                                  forthLine, line);
705                 }
706             });
707     }
708 }