587
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
package com.nokia.helium.imaker.tests;
|
|
18 |
|
628
|
19 |
import static org.junit.Assert.assertArrayEquals;
|
|
20 |
|
587
|
21 |
import java.io.File;
|
|
22 |
|
628
|
23 |
import org.junit.Test;
|
587
|
24 |
|
|
25 |
import com.nokia.helium.imaker.HelpConfigStreamConsumer;
|
|
26 |
|
|
27 |
/**
|
|
28 |
* Test the HelpTargetStreamConsumer.
|
|
29 |
*
|
|
30 |
*/
|
|
31 |
public class TestHelpConfigStreamConsumer {
|
|
32 |
|
|
33 |
/**
|
|
34 |
* Checking if the consumer is parsing correctly the output.
|
|
35 |
*/
|
|
36 |
@Test
|
|
37 |
public void introspectConfiguration() {
|
|
38 |
HelpConfigStreamConsumer consumer = new HelpConfigStreamConsumer();
|
|
39 |
consumer.consumeLine("iMaker 09.24.01, 10-Jun-2009.");
|
|
40 |
consumer.consumeLine("Finding available configuration file(s):");
|
|
41 |
consumer.consumeLine("/epoc32/rom/config/platform/product/image_conf_product.mk");
|
|
42 |
consumer.consumeLine("/epoc32/rom/config/platform/product/image_conf_product_ui.mk");
|
|
43 |
consumer.consumeLine("X:/epoc32/rom/config/platform/product/image_conf_product.mk");
|
|
44 |
consumer.consumeLine("X:/epoc32/rom/config/platform/product/image_conf_product_ui.mk");
|
|
45 |
consumer.consumeLine("");
|
|
46 |
|
|
47 |
// Verifying string output
|
|
48 |
String[] expected = new String[4];
|
|
49 |
expected[0] = "/epoc32/rom/config/platform/product/image_conf_product.mk";
|
|
50 |
expected[1] = "/epoc32/rom/config/platform/product/image_conf_product_ui.mk";
|
|
51 |
expected[2] = "X:/epoc32/rom/config/platform/product/image_conf_product.mk";
|
|
52 |
expected[3] = "X:/epoc32/rom/config/platform/product/image_conf_product_ui.mk";
|
|
53 |
assertArrayEquals(expected, consumer.getConfigurations().toArray(new String[4]));
|
|
54 |
|
|
55 |
// Verifying the file output
|
|
56 |
File[] expectedFile = new File[4];
|
|
57 |
if (new File("/epoc32/rom/config/platform/product/image_conf_product.mk").isAbsolute()) {
|
|
58 |
// Unix like os
|
|
59 |
expectedFile[0] = new File("/epoc32/rom/config/platform/product/image_conf_product.mk");
|
|
60 |
expectedFile[1] = new File("/epoc32/rom/config/platform/product/image_conf_product_ui.mk");
|
|
61 |
expectedFile[2] = new File(new File("."), "X:/epoc32/rom/config/platform/product/image_conf_product.mk");
|
|
62 |
expectedFile[3] = new File(new File("."), "X:/epoc32/rom/config/platform/product/image_conf_product_ui.mk");
|
|
63 |
} else {
|
|
64 |
// Windows like os
|
|
65 |
expectedFile[0] = new File(new File("."), "/epoc32/rom/config/platform/product/image_conf_product.mk");
|
|
66 |
expectedFile[1] = new File(new File("."), "/epoc32/rom/config/platform/product/image_conf_product_ui.mk");
|
|
67 |
expectedFile[2] = new File("X:/epoc32/rom/config/platform/product/image_conf_product.mk");
|
|
68 |
expectedFile[3] = new File("X:/epoc32/rom/config/platform/product/image_conf_product_ui.mk");
|
|
69 |
}
|
|
70 |
assertArrayEquals(expectedFile, consumer.getConfigurations(new File(".")).toArray(new File[4]));
|
|
71 |
}
|
|
72 |
}
|
|
73 |
|