2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 import java
.io
.FileWriter
;
22 import java
.io
.IOException
;
23 import java
.util
.ArrayList
;
24 import lib
.TestParameters
;
25 import share
.LogWriter
;
26 import util
.PropertyName
;
30 * Exchange information to the EIS database
33 public class CwsDataExchangeImpl
36 private final TestParameters param
;
37 private final LogWriter log
;
38 private final BuildEnvTools bet
;
39 private final boolean mDebug
;
41 public CwsDataExchangeImpl(TestParameters param
, LogWriter log
) throws ParameterNotFoundException
45 this.bet
= new BuildEnvTools(param
, log
);
46 mDebug
= param
.getBool(PropertyName
.DEBUG_IS_ACTIVE
);
50 * Returns all module names which are added to the specified childworkspace
51 * @return a String array of all added modules
53 public ArrayList
<String
> getModules()
55 // the cwstouched command send its version information to StdErr.
56 // A piping from StdErr to SdtOut the tcsh does not support.
57 // To find the output easily the echo command is used
58 final String
[] commands
=
60 "echo cwstouched starts here",
62 "echo cwstouched ends here"
65 final ProcessHandler procHdl
= bet
.runCommandsInEnvironmentShell(commands
, null, 20000);
69 log
.println("---> Output of getModules:");
70 log
.println(procHdl
.getOutputText());
71 log
.println("<--- Output of getModules");
72 log
.println("---> Error output of getModules");
73 log
.println(procHdl
.getErrorText());
74 log
.println("<--- Error output of getModules");
77 final String
[] outs
= procHdl
.getOutputText().split("\n");
79 final ArrayList
<String
> moduleNames
= new ArrayList
<String
>();
80 boolean bStart
= false;
81 for (int i
= 0; i
< outs
.length
; i
++)
83 final String line
= outs
[i
];
84 if (line
.startsWith("cwstouched starts here"))
89 if (line
.startsWith("cwstouched ends here"))
94 if (bStart
&& line
.length() > 1)
96 moduleNames
.add(line
);
104 * Set the test status of cws related UnoAPI tests to the EIS dabase
105 * @param status the status of the UnoAPI test
107 public void setUnoApiCwsStatus(boolean status
)
110 FileWriter out
= null;
111 String statusFile
= null;
115 final String stat
= status ?
".PASSED.OK" : ".PASSED.FAILED";
117 statusFile
= utils
.getUsersTempDir() +
118 System
.getProperty("file.separator") +
120 (String
) param
.get(PropertyName
.VERSION
) +
121 "_" + param
.get(PropertyName
.OPERATING_SYSTEM
) + stat
+ ".txt";
123 out
= new FileWriter(statusFile
);
129 final String
[] commands
=
131 "cwsattach " + statusFile
134 bet
.runCommandsInEnvironmentShell(commands
, null, 5000);
137 catch (IOException ex
)
139 System
.out
.println("ERROR: could not attach file '" + statusFile
+ "' to cws\n" + ex
.toString());
147 catch (IOException ex
)
149 ex
.printStackTrace();