1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.model.support;
14
15 import java.io.FileWriter;
16 import java.io.IOException;
17 import java.io.PrintWriter;
18
19 import com.eviware.soapui.model.TestPropertyHolder;
20 import com.eviware.soapui.model.testsuite.TestProperty;
21
22 public class TestPropertyUtils
23 {
24 public static int saveTo( TestPropertyHolder propertyHolder, String fileName ) throws IOException
25 {
26 PrintWriter writer = new PrintWriter( new FileWriter( fileName ));
27
28 for( TestProperty prop : propertyHolder.getPropertyList() )
29 {
30 writer.print( prop.getName() );
31 writer.print('=');
32 String[] lines = prop.getValue().split( "\n" );
33 for( int c = 0; c < lines.length; c++ )
34 {
35 if( c > 0 )
36 writer.println( "//" );
37 writer.print( lines[c] );
38 }
39
40 writer.println();
41 }
42
43 writer.close();
44 return propertyHolder.getPropertyCount();
45 }
46 }