1 /*******************************************************************************
2  *  Copyright (c) 2008, 2017 IBM Corporation and others.
3  *
4  *  This program and the accompanying materials
5  *  are made available under the terms of the Eclipse Public License 2.0
6  *  which accompanies this distribution, and is available at
7  *  https://www.eclipse.org/legal/epl-2.0/
8  *
9  *  SPDX-License-Identifier: EPL-2.0
10  *
11  *  Contributors:
12  *      IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.equinox.p2.tests.touchpoint.natives;
15 
16 import java.io.File;
17 import java.util.HashMap;
18 import java.util.Map;
19 import org.eclipse.equinox.internal.p2.touchpoint.natives.NativeTouchpoint;
20 import org.eclipse.equinox.p2.engine.IProfile;
21 import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
22 
23 public class NativeTouchpointTest extends AbstractProvisioningTest {
24 
NativeTouchpointTest(String name)25 	public NativeTouchpointTest(String name) {
26 		super(name);
27 	}
28 
NativeTouchpointTest()29 	public NativeTouchpointTest() {
30 		super("");
31 	}
32 
testInitializeCompletePhase()33 	public void testInitializeCompletePhase() {
34 		NativeTouchpoint touchpoint = new NativeTouchpoint();
35 
36 		Map<String, Object> parameters = new HashMap<>();
37 		IProfile profile = createProfile("test");
38 
39 		touchpoint.initializePhase(null, profile, "test", parameters);
40 		touchpoint.completePhase(null, profile, "test", parameters);
41 
42 		parameters.clear();
43 		Map<String, String> profileProperties = new HashMap<>();
44 		File installFolder = getTempFolder();
45 		profileProperties.put(IProfile.PROP_INSTALL_FOLDER, installFolder.toString());
46 		profile = createProfile("test", profileProperties);
47 
48 		touchpoint.initializePhase(null, profile, "test", parameters);
49 		touchpoint.completePhase(null, profile, "test", parameters);
50 	}
51 
testQualifyAction()52 	public void testQualifyAction() {
53 		NativeTouchpoint touchpoint = new NativeTouchpoint();
54 		assertEquals("org.eclipse.equinox.p2.touchpoint.natives.chmod", touchpoint.qualifyAction("chmod"));
55 	}
56 }
57