1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*******************************************************************************
* Copyright (c) 2008, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.equinox.p2.tests.ui.operations;
import org.eclipse.equinox.internal.p2.ui.ProvUI;
import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.p2.engine.*;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.tests.ui.AbstractProvisioningUITest;
/**
*
*/
public class SizingTest extends AbstractProvisioningUITest {
public void testEmptySizing() {
String profileId = "testEmptySizing";
IProfile testProfile = createProfile(profileId);
ProfileChangeRequest request = new ProfileChangeRequest(testProfile);
IProvisioningPlan plan = null;
plan = getPlanner(getSession().getProvisioningAgent()).getProvisioningPlan(request, new ProvisioningContext(getAgent()), getMonitor());
long size = ProvUI.SIZE_NOTAPPLICABLE;
size = ProvUI.getSize(getEngine(), plan, new ProvisioningContext(getAgent()), getMonitor());
assertEquals("1.0", 0, size);
}
/**
* Tests a simple sizing operation with an IU containing no artifacts
*/
public void testSimpleSizing() {
IInstallableUnit f1 = createIU("f1", DEFAULT_VERSION, true);
String profileId = "testSimpleSizing";
IProfile testProfile = createProfile(profileId);
ProfileChangeRequest request = new ProfileChangeRequest(testProfile);
request.add(f1);
IProvisioningPlan plan = null;
plan = getPlanner(getSession().getProvisioningAgent()).getProvisioningPlan(request, new ProvisioningContext(getAgent()), getMonitor());
long size = ProvUI.SIZE_NOTAPPLICABLE;
size = ProvUI.getSize(getEngine(), plan, new ProvisioningContext(getAgent()), getMonitor());
assertEquals("1.0", 0, size);
}
}
|