本文整理汇总了Java中net.ssehub.easy.varModel.model.Project.setVersion方法的典型用法代码示例。如果您正苦于以下问题:Java Project.setVersion方法的具体用法?Java Project.setVersion怎么用?Java Project.setVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.ssehub.easy.varModel.model.Project
的用法示例。
在下文中一共展示了Project.setVersion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: irrelevantConflict
import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
* Two projects conflict with a non-existing project.
*
* @throws RestrictionEvaluationException shall not occur
* @throws ValueDoesNotMatchTypeException shall not occur
* @throws CSTSemanticException shall not occur
*/
@Test
public final void irrelevantConflict() throws RestrictionEvaluationException,
ValueDoesNotMatchTypeException, CSTSemanticException {
final VarModel model = VarModel.INSTANCE;
final String suffix = "_irrelevantConflict";
Project root = new Project("root" + suffix);
root.setVersion(new Version(1));
createImport(root, "c" + suffix, false, OclKeyWords.EQUALS, new Version(1));
model.updateModel(root, createDummyURI(root));
Project b = new Project("b" + suffix);
b.setVersion(new Version(1));
createImport(b, "c" + suffix, false, OclKeyWords.EQUALS, new Version(1));
model.updateModel(b, createDummyURI(b));
List<IMessage> msgList = VarModel.INSTANCE.resolveImports(root, createDummyURI(root), null);
Assert.assertNotSame(0, msgList.size());
}
示例2: simpleImport
import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
* Simple Import with no restrictions.
*/
@Test
public final void simpleImport() {
final VarModel model = VarModel.INSTANCE;
String suffix = "_simpleImport";
Project root = new Project("root" + suffix);
root.setVersion(new Version(1));
ProjectImport aImport = new ProjectImport("a" + suffix, null);
root.addImport(aImport);
model.updateModel(root, createDummyURI(root));
Project a = new Project("a" + suffix);
a.setVersion(new Version(1));
model.updateModel(a, createDummyURI(a));
List<IMessage> msgList = VarModel.INSTANCE.resolveImports(root, createDummyURI(root), null);
Assert.assertEquals(0, msgList.size());
}
示例3: impossibleImportRestriction
import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
* Impossible import restriction causes error, because the chosen project is restricted.
*
* @throws RestrictionEvaluationException shall not occur
* @throws ValueDoesNotMatchTypeException shall not occur
* @throws CSTSemanticException shall not occur
*/
@Test
public final void impossibleImportRestriction() throws RestrictionEvaluationException,
ValueDoesNotMatchTypeException, CSTSemanticException {
final VarModel model = VarModel.INSTANCE;
final String suffix = "impossibleImportRestriction";
Project root = new Project("root_" + suffix);
root.setVersion(new Version(1));
createImport(root, "a_" + suffix, false, OclKeyWords.GREATER_EQUALS, new Version(3, 1));
model.updateModel(root, createDummyURI(root));
Project a = new Project("a_" + suffix);
a.setVersion(new Version(1));
model.updateModel(a, createDummyURI(a));
List<IMessage> msgList = VarModel.INSTANCE.resolveImports(root, createDummyURI(root), null);
Assert.assertNotEquals(0, msgList.size());
}
示例4: setUp
import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
* Sets up the project before the test runs.
* @throws VersionFormatException
*/
@Before
public void setUp() throws VersionFormatException {
pro1 = new Project("Name1");
pro2 = new Project("Name2");
pro3 = new Project("Name1");
Version version = new Version("1");
pro1.setVersion(version);
pro2.setVersion(version);
pro3.setVersion(version);
vm = VarModel.INSTANCE;
events = vm.events();
imp = new ProjectImport("Name1", "Interface");
pro3.addImport(imp);
}
示例5: testCopyEmptyProjectWithVersion
import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
* Tests whether an empty project may be copied.
*/
@Test
public void testCopyEmptyProjectWithVersion() {
Project original = new Project("testCopyEmptyProjectWithVersion");
original.setVersion(new Version(1, 2, 3, 4, 5));
copyProject(original);
}
示例6: mostTrivialTest
import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
* One project with no restrictions.
*/
@Test
public final void mostTrivialTest() {
final VarModel model = VarModel.INSTANCE;
final String suffix = "_mostTrivialTest";
Project root = new Project("root" + suffix);
root.setVersion(new Version(1));
model.updateModel(root, createDummyURI(root));
List<IMessage> msgList = VarModel.INSTANCE.resolveImports(root, createDummyURI(root), null);
Assert.assertEquals(0, msgList.size());
}
示例7: localImportRestriction
import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
* a imports c1 and b imports c2 -> valid solution, if (local)blackbox-flag is set.
*
* @throws RestrictionEvaluationException shall not occur
* @throws ValueDoesNotMatchTypeException shall not occur
* @throws CSTSemanticException shall not occur
**/
@Test
public final void localImportRestriction() throws RestrictionEvaluationException, ValueDoesNotMatchTypeException,
CSTSemanticException {
final String suffix = "_localImportRestriction";
final VarModel model = VarModel.INSTANCE;
Project root = new Project("root" + suffix);
root.setVersion(new Version(1));
ProjectImport aImport = new ProjectImport("a" + suffix, null);
root.addImport(aImport);
ProjectImport bImport = new ProjectImport("b" + suffix, null);
root.addImport(bImport);
model.updateModel(root, createDummyURI(root));
Project a = new Project("a" + suffix); // imports c1
a.setVersion(new Version(1));
createImport(a, "c" + suffix, false, OclKeyWords.LESS, new Version(2));
model.updateModel(a, createDummyURI(a));
Project b = new Project("b" + suffix); // imports c2
b.setVersion(new Version(1));
createImport(b, "c" + suffix, false, OclKeyWords.GREATER_EQUALS, new Version(2));
model.updateModel(b, createDummyURI(b));
Project c1 = new Project("c" + suffix);
c1.setVersion(new Version(1));
model.updateModel(c1, createDummyURI(c1));
Project c2 = new Project("c" + suffix);
c2.setVersion(new Version(2));
model.updateModel(c2, createDummyURI(c2));
List<IMessage> msgList = VarModel.INSTANCE.resolveImports(root, createDummyURI(root), null);
Assert.assertEquals(0, msgList.size());
}
示例8: invalidImport
import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
* projectimport with missing project.
*/
@Test
public final void invalidImport() {
final VarModel model = VarModel.INSTANCE;
final String suffix = "_invalidImport";
Project root = new Project("root" + suffix);
root.setVersion(new Version(1));
ProjectImport aImport = new ProjectImport("b" + suffix, null);
root.addImport(aImport);
model.updateModel(root, createDummyURI(root));
List<IMessage> msgList = VarModel.INSTANCE.resolveImports(root, createDummyURI(root), null);
Assert.assertNotEquals(0, msgList.size());
}
示例9: circularImports
import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
* Circular project imports.
*/
@Ignore("currently not needed, check is disabled in import resolver as IVML can cope with that")
@Test
public final void circularImports() {
final VarModel model = VarModel.INSTANCE;
final String suffix = "_circularImports";
Project root = new Project("root" + suffix);
root.setVersion(new Version(1));
ProjectImport aImport = new ProjectImport("a" + suffix, null);
root.addImport(aImport);
model.updateModel(root, createDummyURI(root));
Project a = new Project("a" + suffix);
a.setVersion(new Version(1));
ProjectImport bImport = new ProjectImport("b" + suffix, null);
a.addImport(bImport);
model.updateModel(a, createDummyURI(a));
Project b = new Project("b" + suffix);
b.setVersion(new Version(1));
ProjectImport rootImport = new ProjectImport("root" + suffix, null);
b.addImport(rootImport);
model.updateModel(b, createDummyURI(b));
List<IMessage> msgList = VarModel.INSTANCE.resolveImports(root, createDummyURI(root), null);
Assert.assertNotEquals(0, msgList.size());
}
示例10: createImportProject
import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
* Creates the project to be imported.
*/
private void createImportProject() {
impProject = new Project("import");
impProject.setVersion(new Version(0, 9));
iInt = new DecisionVariableDeclaration("iInt", IntegerType.TYPE, impProject);
impProject.add(iInt);
}
示例11: createProject
import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
* Creates the main project.
*
* @throws ModelManagementException in case of "resolving" the imported project fails
*/
private void createProject() throws ModelManagementException {
project = new Project("test");
project.setVersion(new Version(1, 0));
ProjectImport imp = new ProjectImport("imported", null);
imp.setResolved(impProject);
project.addImport(imp);
project.attribute(new net.ssehub.easy.varModel.model.Attribute("bindingTime",
IntegerType.TYPE, project, project)); // just to simplify the process
pInt = new DecisionVariableDeclaration("pInt", IntegerType.TYPE, project);
project.add(pInt);
pString = new DecisionVariableDeclaration("pString", StringType.TYPE, project);
project.add(pString);
pReal = new DecisionVariableDeclaration("pReal", RealType.TYPE, project);
project.add(pReal);
pBoolean = new DecisionVariableDeclaration("pBoolean", BooleanType.TYPE, project);
project.add(pBoolean);
pBooleanUF = new DecisionVariableDeclaration("pBooleanUnfrozen", BooleanType.TYPE, project);
project.add(pBooleanUF);
enm = new net.ssehub.easy.varModel.model.datatypes.Enum("pEnumeration", impProject,
"val1", "val2", "val3");
impProject.add(enm);
pEnum = new DecisionVariableDeclaration("pEnum", enm, project);
project.add(pEnum);
comp = new Compound("pCompound", project);
pcInt = new DecisionVariableDeclaration("pcInt", IntegerType.TYPE, comp);
comp.add(pcInt);
pcString = new DecisionVariableDeclaration("pcString", StringType.TYPE, comp);
comp.add(pcString);
project.add(comp);
pComp = new DecisionVariableDeclaration("pComp", comp, project);
project.add(pComp);
seq = new Sequence("pCompoundSequence", comp, project);
pCompSeq = new DecisionVariableDeclaration("pCompSeq", seq, project);
project.add(pCompSeq);
}
示例12: addVersion
import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
* Adds the current version to <code>destProject</code>.
*
* @param destProject the destination project being set up
* @param srcConfiguration the source configuration
*/
protected void addVersion(Project destProject, Configuration srcConfiguration) {
Version ver = srcConfiguration.getProject().getVersion();
if (null != ver) {
destProject.setVersion(ver);
}
}
示例13: createIVMLProject
import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
* Creates a new IVML project.
* @param projectName Name of the project.
* @param version Version of the project.
* @param storagePath The folder, where the file should be saved.
* @throws PersistenceException If the file cannot be written to the file system.
*/
public static void createIVMLProject(String projectName, Version version, String storagePath)
throws PersistenceException {
Project project = new Project(projectName);
if (null != version) {
project.setVersion(version);
}
writeIVMLProject(project, storagePath);
}
示例14: versionCorrectionTest
import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
* Two-step test.
* First step: define two project of which one includes a false import of the other
* project with respect to the version restriction.
* Second step: the false import (the version restriction) will be corrected by
* updating the version of the imported project in the version restriction.
*
* @throws RestrictionEvaluationException shall not occur
* @throws ValueDoesNotMatchTypeException shall not occur
* @throws CSTSemanticException shall not occur
*/
@Test
public final void versionCorrectionTest() throws RestrictionEvaluationException,
ValueDoesNotMatchTypeException, CSTSemanticException {
VarModel model = VarModel.INSTANCE;
// Construct new product line project with version v0.3.
Project plProject = new Project("PL_ImportTest");
plProject.setVersion(new Version(0, 3));
/*
* Construct new (derived) product project, which imports the product line project.
* However, the import will be restricted to a false version number:
* plProject v0.3, import: v0
*/
Project invalidProductProject = new Project("New_Product");
invalidProductProject.setVersion(new Version(0));
createImport(invalidProductProject, "PL_ImportTest", false, OclKeyWords.EQUALS, new Version(0));
// Add both projects to the variability model
model.updateModel(plProject, createDummyURI(plProject));
model.updateModel(invalidProductProject, createDummyURI(invalidProductProject));
/*
* Resolve the false import.
* Expected result: the number of messages is not 0 as it must contain
* at least one error-message because of the false import.
*/
List<IMessage> msgList = VarModel.INSTANCE.resolveImports(invalidProductProject,
createDummyURI(invalidProductProject), null);
Assert.assertNotSame(0, msgList.size());
/*
* Correct the product (the false import) in terms of creating a new project
* with the same name and version number as the invalid one previously, correct
* the version restriction and add the project again to the model.
*/
Project correctedProductProject = new Project("New_Product");
correctedProductProject.setVersion(new Version(0));
createImport(correctedProductProject, "PL_ImportTest", false, OclKeyWords.EQUALS, new Version(0, 3));
model.updateModel(correctedProductProject, createDummyURI(correctedProductProject));
/*
* Resolve the corrected import.
* Expected result: the number of messages is 0 as no error-message should occur.
*/
msgList = VarModel.INSTANCE.resolveImports(correctedProductProject,
createDummyURI(correctedProductProject), null);
Assert.assertEquals(0, msgList.size());
}
示例15: createProject
import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public IProjectCreationResult createProject(String projectName, File parentFolder, String projectID, boolean lazy)
throws PersistenceException {
ProjectCreationResult result = null;
File projectFolder = new File(parentFolder, projectName);
Configuration config = PersistenceUtils.getConfiguration(projectFolder);
File configFolder = config.getPathFile(PathKind.IVML);
File scriptFolder = config.getPathFile(PathKind.VIL);
boolean projectOk;
if (lazy) {
// this part is for ScaleLog... it might make sense to check for the files in the EASy folder...
projectOk = true;
if (!configFolder.exists()) {
projectOk = configFolder.mkdirs();
if (!configFolder.equals(scriptFolder)) {
projectOk = scriptFolder.mkdirs();
}
File vtlFolder = config.getPathFile(PathKind.VTL);
if (!scriptFolder.equals(vtlFolder)) {
projectOk = vtlFolder.mkdirs();
}
}
} else {
projectOk = configFolder.mkdirs();
if (!configFolder.equals(scriptFolder)) {
projectOk = scriptFolder.mkdirs();
}
}
if (projectOk) {
loadDefaultModels();
// Add location of newly created project to VarModel
try {
PersistenceUtils.addLocation(config, observer);
} catch (ModelManagementException e) {
// Should not happen, but it is also not necessarily to throw this exception.
LOGGER.exception(e);
}
// VarModel Information
Project varModel = new Project(projectName);
varModel.setVersion(PersistenceUtils.defaultVersion());
// Build Script
VariableDeclaration[] declarations = Script.createDefaultParameter();
Script mainBuildScript = new Script(projectName, declarations);
mainBuildScript.setVersion(PersistenceUtils.defaultVersion());
Rule main = new Rule("main", false, declarations, new RuleDescriptor(), mainBuildScript);
mainBuildScript.addRule(main);
PersistentProject pProject = new PersistentProject(varModel, projectFolder, configFolder);
pProject.setScript(new ScriptContainer(mainBuildScript, null, config, true));
pProject.setID(projectID);
pProject.setName(projectName);
save(pProject);
// Register newly created varModel (ivml project).
String configPath = configFolder.getAbsolutePath();
String scriptPath = scriptFolder.getAbsolutePath();
File configFile = new File(PersistenceUtils.ivmlFileLocation(varModel, configPath));
VarModel.INSTANCE.updateModel(varModel, configFile.toURI());
File buildFile = new File(PersistenceUtils.vilFileLocation(mainBuildScript, scriptPath));
BuildModel.INSTANCE.updateModel(mainBuildScript, buildFile.toURI());
result = new ProjectCreationResult(projectFolder, projectID, configFile, varModel, mainBuildScript);
} else {
throw new PersistenceException("System cannot create folders for the new project at the specified location:"
+ " " + parentFolder);
}
return result;
}