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 import java.util.Arrays;
19
20 import com.eviware.soapui.impl.wsdl.MutableTestPropertyHolder;
21 import com.eviware.soapui.model.TestPropertyHolder;
22 import com.eviware.soapui.model.testsuite.TestProperty;
23
24 public class TestPropertyUtils
25 {
26 public static int saveTo( TestPropertyHolder propertyHolder, String fileName ) throws IOException
27 {
28 PrintWriter writer = new PrintWriter( new FileWriter( fileName ) );
29
30 for( TestProperty prop : propertyHolder.getPropertyList() )
31 {
32 writer.print( prop.getName() );
33 writer.print( '=' );
34 String value = prop.getValue();
35 if( value == null )
36 value = "";
37
38 String[] lines = value.split( "\n" );
39 for( int c = 0; c < lines.length; c++ )
40 {
41 if( c > 0 )
42 writer.println( "//" );
43 writer.print( lines[c] );
44 }
45
46 writer.println();
47 }
48
49 writer.close();
50 return propertyHolder.getPropertyCount();
51 }
52
53 public synchronized static void sortProperties( MutableTestPropertyHolder holder )
54 {
55 }
56 }