Search in sources :

Example 36 with ModelBuilderOperation

use of org.whole.lang.builders.ModelBuilderOperation in project whole by wholeplatform.

the class PersistenceTest method testSingleBuilder2Java.

@Test
public void testSingleBuilder2Java() {
    ModelBuilderOperation op = new ModelBuilderOperation();
    JavaStoreProducerBuilderOperation javaOp = new JavaStoreProducerBuilderOperation(op);
    ((JavaStoreProducerBuilder) javaOp.wGetBuilder()).buildStartCompilationUnit("test", "Test");
    try {
        Properties props = PropertiesUtils.translate(System.getProperties());
        props.getEntries().wAdd(0, createResolver(PropertiesEntityDescriptorEnum.Property));
        new ModelTemplate(props).apply(javaOp);
    } catch (IOException e) {
        e.printStackTrace();
    }
    // new TopDownTraversal(new ModelsModel().create()).apply(javaOp);
    ((JavaStoreProducerBuilder) javaOp.wGetBuilder()).buildEndCompilationUnit();
    // new ModelsModel().apply(new JavaStoreProducerBuilderOperation(op));
    IEntity model = op.wGetResult();
    PrettyPrinterOperation.prettyPrint(model);
}
Also used : ModelBuilderOperation(org.whole.lang.builders.ModelBuilderOperation) ModelTemplate(org.whole.lang.templates.ModelTemplate) JavaStoreProducerBuilder(org.whole.lang.java.util.JavaStoreProducerBuilder) IEntity(org.whole.lang.model.IEntity) JavaStoreProducerBuilderOperation(org.whole.lang.java.util.JavaStoreProducerBuilderOperation) IOException(java.io.IOException) Properties(org.whole.lang.properties.model.Properties) Test(org.junit.Test)

Example 37 with ModelBuilderOperation

use of org.whole.lang.builders.ModelBuilderOperation in project whole by wholeplatform.

the class PersistenceTest method testSingleModel2Xml.

@Test
public void testSingleModel2Xml() {
    ModelBuilderOperation op = new ModelBuilderOperation();
    IEntity model = new ModelsModel().create();
    new ModelTemplate(model).apply(new XmlStoreProducerBuilderOperation(op));
    IEntity xmlModel = op.wGetResult();
    PrettyPrinterOperation.prettyPrint(xmlModel);
}
Also used : ModelBuilderOperation(org.whole.lang.builders.ModelBuilderOperation) ModelTemplate(org.whole.lang.templates.ModelTemplate) IEntity(org.whole.lang.model.IEntity) XmlStoreProducerBuilderOperation(org.whole.lang.xml.util.XmlStoreProducerBuilderOperation) ModelsModel(org.whole.lang.models.codebase.ModelsModel) Test(org.junit.Test)

Example 38 with ModelBuilderOperation

use of org.whole.lang.builders.ModelBuilderOperation in project whole by wholeplatform.

the class PersistenceTest method testMultipleBuilders2Xml.

@Test
public void testMultipleBuilders2Xml() {
    ModelBuilderOperation op = new ModelBuilderOperation();
    XmlStoreProducerBuilderOperation xmlOp = new XmlStoreProducerBuilderOperation(op);
    ((XmlStoreProducerBuilder) xmlOp.wGetBuilder()).buildStartDocument();
    new WholeLanguage().apply(xmlOp);
    ((XmlStoreProducerBuilder) xmlOp.wGetBuilder()).buildEndDocument();
    IEntity xmlModel = op.wGetResult();
    PrettyPrinterOperation.prettyPrint(xmlModel);
}
Also used : ModelBuilderOperation(org.whole.lang.builders.ModelBuilderOperation) XmlStoreProducerBuilder(org.whole.lang.xml.util.XmlStoreProducerBuilder) IEntity(org.whole.lang.model.IEntity) XmlStoreProducerBuilderOperation(org.whole.lang.xml.util.XmlStoreProducerBuilderOperation) WholeLanguage(org.whole.lang.misc.codebase.WholeLanguage) Test(org.junit.Test)

Example 39 with ModelBuilderOperation

use of org.whole.lang.builders.ModelBuilderOperation in project whole by wholeplatform.

the class PersistenceTest method _testXml2Builder.

public void _testXml2Builder() throws ParserConfigurationException, SAXException, IOException {
    ModelBuilderOperation op = new ModelBuilderOperation();
    SaxConsumerHandler.parse(this.getClass().getResourceAsStream("persistenceTest.xwl"), "UTF-8", true, new XmlStoreConsumerBuilderOperation(op));
}
Also used : ModelBuilderOperation(org.whole.lang.builders.ModelBuilderOperation) XmlStoreConsumerBuilderOperation(org.whole.lang.xml.util.XmlStoreConsumerBuilderOperation)

Example 40 with ModelBuilderOperation

use of org.whole.lang.builders.ModelBuilderOperation in project whole by wholeplatform.

the class ArtifactsGeneratorTest method getMetadataPattern.

private IEntity getMetadataPattern() {
    ModelBuilderOperation op = new ModelBuilderOperation();
    IArtifactsBuilder b0 = (IArtifactsBuilder) op.wGetBuilder(ArtifactsLanguageKit.URI);
    ICommonsBuilder cb = (ICommonsBuilder) op.wGetBuilder(CommonsLanguageKit.URI);
    b0.Workspace_();
    cb.Resolver();
    b0.Projects_(1);
    b0.Project_();
    b0.Name("test.java.project2");
    b0.Natures_(1);
    b0.Nature("org.eclipse.jdt.core.javanature");
    b0._Natures();
    cb.Resolver();
    b0.Artifacts_(1);
    b0.FolderArtifact_();
    b0.Name("src/org.whole.lang");
    b0.Metadata_();
    b0.Copyright("Copyright 2004-2013 _name_.");
    b0.License("* All rights reserved. This program and the accompanying materials\n* are made available under the terms of the GNU Lesser General Public License\n* which accompanies this distribution, and is available at\n* http://www.gnu.org/copyleft/lesser.html");
    b0.Author("_name_");
    b0.Attributes_(1);
    b0.Attribute("source");
    b0._Attributes();
    b0._Metadata();
    b0.Artifacts_(1);
    b0.PackageArtifact_();
    b0.Name("org.whole.lang");
    cb.Resolver();
    b0.Artifacts();
    b0._PackageArtifact();
    b0._Artifacts();
    b0._FolderArtifact();
    b0._Artifacts();
    b0._Project();
    b0._Projects();
    b0._Workspace();
    return op.wGetResult();
}
Also used : ModelBuilderOperation(org.whole.lang.builders.ModelBuilderOperation) IArtifactsBuilder(org.whole.lang.artifacts.builders.IArtifactsBuilder) ICommonsBuilder(org.whole.lang.commons.builders.ICommonsBuilder)

Aggregations

ModelBuilderOperation (org.whole.lang.builders.ModelBuilderOperation)41 IEntity (org.whole.lang.model.IEntity)21 Test (org.junit.Test)18 ICommonsBuilder (org.whole.lang.commons.builders.ICommonsBuilder)8 File (java.io.File)6 ModelTemplate (org.whole.lang.templates.ModelTemplate)6 XmlNormalizerBuilderOperation (org.whole.lang.xml.codebase.XmlNormalizerBuilderOperation)6 ResourceTemplate (org.whole.lang.artifacts.templates.ResourceTemplate)5 IBindingManager (org.whole.lang.bindings.IBindingManager)5 IXmlBuilder (org.whole.lang.xml.builders.IXmlBuilder)5 IArtifactsBuilder (org.whole.lang.artifacts.builders.IArtifactsBuilder)4 StreamPersistenceProvider (org.whole.lang.codebase.StreamPersistenceProvider)4 Document (org.whole.lang.xml.model.Document)4 XmlStoreProducerBuilderOperation (org.whole.lang.xml.util.XmlStoreProducerBuilderOperation)4 XmlStoreConsumerVisitor (org.whole.lang.xml.util.XmlStoreConsumerVisitor)3 Category (org.junit.experimental.categories.Category)2 WorkspaceTemplate (org.whole.lang.artifacts.templates.WorkspaceTemplate)2 IBuilderOperation (org.whole.lang.builders.IBuilderOperation)2 JavaStoreProducerBuilder (org.whole.lang.java.util.JavaStoreProducerBuilder)2 JavaStoreProducerBuilderOperation (org.whole.lang.java.util.JavaStoreProducerBuilderOperation)2