# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /work/src/netbeans-cm # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: api.maven.archetype/apichanges.xml --- api.maven.archetype/apichanges.xml +++ api.maven.archetype/apichanges.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + Maven Archetype + + + + + + + + + + Created the public Maven Archetype api + + + + + +

+ Public API for creating New Project wizards based on the maven-archetype-plugin. +

+
+ + + + +
+ +
+ + + + + + + Change History for Maven Archetype + + + + + + +

Introduction

+ +

This document lists changes made to the Maven Project API.

+ + +
+ + +

@FOOTER@

+ + +
+ +
Index: api.maven.archetype/arch.xml --- api.maven.archetype/arch.xml +++ api.maven.archetype/arch.xml @@ -0,0 +1,1130 @@ + + + +]> + + + + &api-questions; + + + + + + + + + +

+ creating of New Project wizards based on the maven-archetype-plugin. +

+
+ + + + + + + +

+ "Projects/org-netbeans-modules-maven/Archetypes" folder contains fileobjects + that represent archetypes. The archetypes are defined by the following file attributes: +

+ + + + + + + + + +
groupIdmandatory
artifactIdmandatory
versionmandatory
repositoryoptionalurl of the archetype's repository
nameBundleKeyoptionalkey in bundle file that holds localized name
descriptionBundleKeyoptionalkey in bundle file that holds localized description
+
+ +
+ + + +

+ No environment or Java System properties. +

+
+ + + + + + +

+ XXX no answer for arch-quality +

+
+ + + + + +

+ XXX no answer for arch-time +

+
+ + + + + +

+ XXX no answer for arch-what +

+
+ + + + + + + + + + + + +

+ XXX no answer for compat-deprecation +

+
+ + + + + +

+ XXX no answer for compat-i18n +

+
+ + + + + +

+ XXX no answer for compat-standards +

+
+ + + + + +

+ XXX no answer for compat-version +

+
+ + + + + +

+ XXX no answer for dep-jre +

+
+ + + + + +

+ XXX no answer for dep-jrejdk +

+
+ + + + + + + + + + + + +

+ XXX no answer for dep-non-nb +

+
+ + + + + +

+ XXX no answer for dep-platform +

+
+ + + + + +

+ No special requirements here. +

+
+ + + + + +

+ XXX no answer for deploy-jar +

+
+ + + + + +

+ XXX no answer for deploy-nbm +

+
+ + + + + +

+ XXX no answer for deploy-packages +

+
+ + + + + +

+ XXX no answer for deploy-shared +

+
+ + + + + +

+ XXX no answer for exec-ant-tasks +

+
+ + + + + +

+ XXX no answer for exec-classloader +

+
+ + + + + +

+ XXX no answer for exec-component +

+
+ + + + + +

+ XXX no answer for exec-introspection +

+
+ + + + + +

+ XXX no answer for exec-privateaccess +

+
+ + + + + +

+ XXX no answer for exec-process +

+
+ + + + + +

+ XXX no answer for exec-reflection +

+
+ + + + + +

+ XXX no answer for exec-threading +

+
+ + + + + +

+ XXX no answer for format-clipboard +

+
+ + + + + +

+ XXX no answer for format-dnd +

+
+ + + + + +

+ XXX no answer for format-types +

+
+ + + + + +

+ XXX no answer for lookup-lookup +

+
+ + + + + +

+ XXX no answer for lookup-register +

+
+ + + + + +

+ XXX no answer for lookup-remove +

+
+ + + + + +

+ XXX no answer for perf-exit +

+
+ + + + + +

+ XXX no answer for perf-huge_dialogs +

+
+ + + + + +

+ XXX no answer for perf-limit +

+
+ + + + + +

+ XXX no answer for perf-mem +

+
+ + + + + +

+ XXX no answer for perf-menus +

+
+ + + + + +

+ XXX no answer for perf-progress +

+
+ + + + + +

+ XXX no answer for perf-scale +

+
+ + + + + +

+ XXX no answer for perf-spi +

+
+ + + + + +

+ XXX no answer for perf-startup +

+
+ + + + + +

+ XXX no answer for perf-wakeup +

+
+ + + + + +

+ XXX no answer for resources-file +

+
+ + + + + +

+ XXX no answer for resources-layer +

+
+ + + + + +

+ XXX no answer for resources-mask +

+
+ + + + + +

+ XXX no answer for resources-preferences +

+
+ + + + + +

+ XXX no answer for security-grant +

+
+ + + + + +

+ XXX no answer for security-policy +

+
+ +
Index: api.maven.archetype/build.xml --- api.maven.archetype/build.xml +++ api.maven.archetype/build.xml @@ -0,0 +1,50 @@ + + + + + Builds, tests, and runs the project org.netbeans.api.maven.archetype + + Index: api.maven.archetype/manifest.mf --- api.maven.archetype/manifest.mf +++ api.maven.archetype/manifest.mf @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +OpenIDE-Module: org.netbeans.api.maven.archetype +OpenIDE-Module-Specification-Version: 1.0 +OpenIDE-Module-Localizing-Bundle: org/netbeans/api/maven/archetype/Bundle.properties +AutoUpdate-Show-In-Client: false Index: api.maven.archetype/nbproject/project.properties --- api.maven.archetype/nbproject/project.properties +++ api.maven.archetype/nbproject/project.properties @@ -0,0 +1,46 @@ +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. +# +# Copyright 2010 Oracle and/or its affiliates. All rights reserved. +# +# Oracle and Java are registered trademarks of Oracle and/or its affiliates. +# Other names may be trademarks of their respective owners. +# +# The contents of this file are subject to the terms of either the GNU +# General Public License Version 2 only ("GPL") or the Common +# Development and Distribution License("CDDL") (collectively, the +# "License"). You may not use this file except in compliance with the +# License. You can obtain a copy of the License at +# http://www.netbeans.org/cddl-gplv2.html +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the +# specific language governing permissions and limitations under the +# License. When distributing the software, include this License Header +# Notice in each file and include the License file at +# nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the GPL Version 2 section of the License file that +# accompanied this code. If applicable, add the following below the +# License Header, with the fields enclosed by brackets [] replaced by +# your own identifying information: +# "Portions Copyrighted [year] [name of copyright owner]" +# +# If you wish your version of this file to be governed by only the CDDL +# or only the GPL Version 2, indicate your decision by adding +# "[Contributor] elects to include this software in this distribution +# under the [CDDL or GPL Version 2] license." If you do not indicate a +# single choice of license, a recipient has the option to distribute +# your version of this file under either the CDDL, the GPL Version 2 or +# to extend the choice of license to its licensees as provided above. +# However, if you add GPL Version 2 code and therefore, elected the GPL +# Version 2 license, then the option applies only if the new code is +# made subject to such option by the copyright holder. +# +# Contributor(s): +# +# Portions Copyrighted 2008 Sun Microsystems, Inc. + +javac.source=1.6 +javac.compilerargs=-Xlint -Xlint:-serial +javadoc.apichanges=${basedir}/apichanges.xml +javadoc.arch=${basedir}/arch.xml + + Index: api.maven.archetype/nbproject/project.xml --- api.maven.archetype/nbproject/project.xml +++ api.maven.archetype/nbproject/project.xml @@ -0,0 +1,122 @@ + + + + org.netbeans.modules.apisupport.project + + + org.netbeans.api.maven.archetype + + + org.netbeans.api.annotations.common + + + + 1 + 1.24 + + + + org.netbeans.modules.maven + + + + 2 + 2.106 + + + + org.openide.dialogs + + + + 7.22 + + + + org.openide.filesystems + + + + 7.49 + + + + org.openide.loaders + + + + 7.47 + + + + org.openide.util.lookup + + + + 8.0 + + + + + + unit + + org.netbeans.libs.junit4 + + + + org.netbeans.modules.nbjunit + + + + + + + org.netbeans.api.maven.archetype + + + + Index: api.maven.archetype/src/org/netbeans/api/maven/archetype/Archetype.java --- api.maven.archetype/src/org/netbeans/api/maven/archetype/Archetype.java +++ api.maven.archetype/src/org/netbeans/api/maven/archetype/Archetype.java @@ -0,0 +1,215 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2010 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2008 Sun Microsystems, Inc. + */ + +package org.netbeans.api.maven.archetype; + +import org.netbeans.api.annotations.common.NonNull; + +/** + * Simple model class to describe a Maven archetype. To be created by ArchetypeProvider + * implementations, consumed by the New Maven Project wizard. + * + * @author Tomas Stupka + * @since 1.0 + */ +public final class Archetype { + + private org.netbeans.modules.maven.api.archetype.Archetype delegate; + + /** + * C'tor + * + * @since 1.0 + */ + public Archetype() { + delegate = new org.netbeans.modules.maven.api.archetype.Archetype(); + } + + /** + * Returns the artifact id. + * + * @return the artifact id + * @since 1.0 + */ + public String getArtifactId() { + return delegate.getArtifactId(); + } + + /** + * Sets the artifact id + * + * @param artifactId + * @since 1.0 + */ + public void setArtifactId(String artifactId) { + delegate.setArtifactId(artifactId); + } + + /** + * Returns the group id. + * + * @return the group id + * @since 1.0 + */ + public String getGroupId() { + return delegate.getGroupId(); + } + + /** + * Sets the group id + * + * @param groupId + * @since 1.0 + */ + public void setGroupId(String groupId) { + delegate.setGroupId(groupId); + } + + /** + * Returns the version. + * + * @return the version + * @since 1.0 + */ + public String getVersion() { + return delegate.getVersion(); + } + + /** + * Sets the version. + * + * @param version + * @since 1.0 + */ + public void setVersion(String version) { + delegate.setVersion(version); + } + + /** + * Returns the name. + * + * @return the name + * @since 1.0 + */ + public @NonNull String getName() { + return delegate.getName(); + } + + /** + * Sets the name. + * + * @param name + * @since 1.0 + */ + public void setName(String name) { + delegate.setName(name); + } + + /** + * Returns the description. Is an optional property. + * + * @return the description or null if none available + * @since 1.0 + */ + public String getDescription() { + return delegate.getDescription(); + } + + /** + * Sets the description. + * + * @param description + * @since 1.0 + */ + public void setDescription(String description) { + delegate.setDescription(description); + } + + /** + * Sets the repository. Is an optional property. + * + * @param repository + * @since 1.0 + */ + public void setRepository(String repository) { + delegate.setRepository(repository); + } + + /** + * Returns the repository. Is an optional property. + * + * @return the repository or null if none available + * @since 1.0 + */ + public String getRepository() { + return delegate.getRepository(); + } + + @Override + public int hashCode() { + return getGroupId().trim().hashCode() + 13 * getArtifactId().trim().hashCode() + 23 * getVersion().trim().hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof Archetype)) { + return false; + } + Archetype ar1 = (Archetype)obj; + boolean gr = ar1.getGroupId().trim().equals(getGroupId().trim()); + if (!gr) { + return false; + } + boolean ar = ar1.getArtifactId().trim().equals(getArtifactId().trim()); + if (!ar) { + return false; + } + boolean ver = ar1.getVersion().trim().equals(getVersion().trim()); + return ver; + } + + @Override + public String toString() { + return delegate.toString(); + } + +} Index: api.maven.archetype/src/org/netbeans/api/maven/archetype/ArchetypeWizards.java --- api.maven.archetype/src/org/netbeans/api/maven/archetype/ArchetypeWizards.java +++ api.maven.archetype/src/org/netbeans/api/maven/archetype/ArchetypeWizards.java @@ -0,0 +1,140 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2010 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2010 Sun Microsystems, Inc. + */ + +package org.netbeans.api.maven.archetype; + +import java.io.File; +import java.io.IOException; +import java.util.Map; +import java.util.Set; +import org.netbeans.api.annotations.common.NullAllowed; +import org.netbeans.api.templates.TemplateRegistration; +import org.openide.WizardDescriptor; +import org.openide.filesystems.FileObject; + +/** + * Utilities for creating New Project wizards based on maven-archetype-plugin. + * + * @author Tomas Stupka + * @since 1.0 + */ +public class ArchetypeWizards { + + private ArchetypeWizards() { } + + /** + * Run a single archetype. + * + * @param projDir the new project directory (must be normalized first!) (note: parent dir is actually passed to plugin, i.e. assumes that project name matches this basedir) + * @param vi metadata for new project + * @param arch the archetype to process + * @param additionalProperties any additional archetype properties, or null + * @param updateLastUsedProjectDir true to update last-used project directory for next wizard run + * @since 1.0 + * @throws java.io.IOException + */ + public static void createFromArchetype(File projDir, ProjectInfo vi, Archetype arch, @NullAllowed Map additionalProperties, boolean updateLastUsedProjectDir) throws IOException { + org.netbeans.modules.maven.api.archetype.ArchetypeWizards.createFromArchetype( + projDir, + convertProjectInfo(vi), + convertArchetype(arch), + additionalProperties, + updateLastUsedProjectDir); + } + + /** + * Opens newly created Maven projects. + * + * @param dirF the top-level dir to check in + * @param mainProjectDir the dir containing the main project, or null + * @return set of project directories + * @since 1.0 + * @throws java.io.IOException + */ + public static Set openProjects(File dirF, File mainProjectDir) throws IOException { + return org.netbeans.modules.maven.api.archetype.ArchetypeWizards.openProjects(dirF, mainProjectDir); + } + + /** + * Log new project usage. + * + * @param groupId + * @param artifactId + * @param version + * @since 1.0 + */ + public static void logUsage(String groupId, String artifactId, String version) { + org.netbeans.modules.maven.api.archetype.ArchetypeWizards.logUsage(groupId, artifactId, version); + } + + /** + * Wizard iterator using a predetermined archetype. + * + * @param groupId + * @param artifactId + * @param version + * @param repository + * @param title + * @return a wizard iterators + * @since 1.0 + * @see TemplateRegistration + * @see #TEMPLATE_FOLDER + */ + public static WizardDescriptor.InstantiatingIterator definedArchetype(String groupId, String artifactId, String version, @NullAllowed String repository, String title) { + return org.netbeans.modules.maven.api.archetype.ArchetypeWizards.definedArchetype(groupId, artifactId, version, repository, title); + } + + private static org.netbeans.modules.maven.api.archetype.ProjectInfo convertProjectInfo(ProjectInfo pi) { + return new org.netbeans.modules.maven.api.archetype.ProjectInfo(pi.getGroupId(), pi.getArtifactId(), pi.getVersion(), pi.getPackageName()); + } + + private static org.netbeans.modules.maven.api.archetype.Archetype convertArchetype(Archetype a) { + org.netbeans.modules.maven.api.archetype.Archetype archetype = new org.netbeans.modules.maven.api.archetype.Archetype(); + archetype.setGroupId(a.getGroupId()); + archetype.setArtifactId(a.getArtifactId()); + archetype.setVersion(a.getVersion()); + archetype.setName(a.getName()); + archetype.setDescription(a.getDescription()); + archetype.setRepository(a.getRepository()); + return archetype; + } +} Index: api.maven.archetype/src/org/netbeans/api/maven/archetype/Bundle.properties --- api.maven.archetype/src/org/netbeans/api/maven/archetype/Bundle.properties +++ api.maven.archetype/src/org/netbeans/api/maven/archetype/Bundle.properties @@ -0,0 +1,43 @@ +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. +# +# Copyright 2010 Oracle and/or its affiliates. All rights reserved. +# +# Oracle and Java are registered trademarks of Oracle and/or its affiliates. +# Other names may be trademarks of their respective owners. +# +# The contents of this file are subject to the terms of either the GNU +# General Public License Version 2 only ("GPL") or the Common +# Development and Distribution License("CDDL") (collectively, the +# "License"). You may not use this file except in compliance with the +# License. You can obtain a copy of the License at +# http://www.netbeans.org/cddl-gplv2.html +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the +# specific language governing permissions and limitations under the +# License. When distributing the software, include this License Header +# Notice in each file and include the License file at +# nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the GPL Version 2 section of the License file that +# accompanied this code. If applicable, add the following below the +# License Header, with the fields enclosed by brackets [] replaced by +# your own identifying information: +# "Portions Copyrighted [year] [name of copyright owner]" +# +# If you wish your version of this file to be governed by only the CDDL +# or only the GPL Version 2, indicate your decision by adding +# "[Contributor] elects to include this software in this distribution +# under the [CDDL or GPL Version 2] license." If you do not indicate a +# single choice of license, a recipient has the option to distribute +# your version of this file under either the CDDL, the GPL Version 2 or +# to extend the choice of license to its licensees as provided above. +# However, if you add GPL Version 2 code and therefore, elected the GPL +# Version 2 license, then the option applies only if the new code is +# made subject to such option by the copyright holder. +# +# Contributor(s): +# +# Portions Copyrighted 2008 Sun Microsystems, Inc. + +OpenIDE-Module-Display-Category=Maven +OpenIDE-Module-Name=Maven Archetype API +OpenIDE-Module-Long-Description=Maven archetypes related API. Index: api.maven.archetype/src/org/netbeans/api/maven/archetype/ProjectInfo.java --- api.maven.archetype/src/org/netbeans/api/maven/archetype/ProjectInfo.java +++ api.maven.archetype/src/org/netbeans/api/maven/archetype/ProjectInfo.java @@ -0,0 +1,108 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2010 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2009 Sun Microsystems, Inc. + */ + +package org.netbeans.api.maven.archetype; + +/** + * Information about one project to be created. + * + * @author Tomas Stupka + * @since 1.0 + */ +public final class ProjectInfo { + + private final org.netbeans.modules.maven.api.archetype.ProjectInfo delegate; + + /** + * C'tor + * + * @param groupId the group id + * @param artifactId the artifact id + * @param version the version + * @param packageName the package name + * @since 1.0 + */ + public ProjectInfo(String groupId, String artifactId, String version, String packageName) { + delegate = new org.netbeans.modules.maven.api.archetype.ProjectInfo(groupId, artifactId, version, packageName); + } + + /** + * Returns the group id + * + * @return + * @since 1.0 + */ + public String getGroupId() { + return delegate.groupId; + } + + /** + * Returns the artifact id. + * + * @return + * @since 1.0 + */ + public String getArtifactId() { + return delegate.artifactId; + } + + /** + * Returns the version. + * + * @return + * @since 1.0 + */ + public String getVersion() { + return delegate.version; + } + + /** + * Returns the package name. + * + * @return + * @since 1.0 + */ + public String getPackageName() { + return delegate.packageName; + } + +} Index: api.maven.archetype/test/unit/src/org/netbeans/modules/maven/archetype/api/ArchetypeTest.java --- api.maven.archetype/test/unit/src/org/netbeans/modules/maven/archetype/api/ArchetypeTest.java +++ api.maven.archetype/test/unit/src/org/netbeans/modules/maven/archetype/api/ArchetypeTest.java @@ -0,0 +1,116 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2011 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2011 Sun Microsystems, Inc. + */ + +package org.netbeans.modules.maven.archetype.api; + +import org.netbeans.api.maven.archetype.Archetype; +import org.netbeans.junit.NbTestCase; + +public class ArchetypeTest extends NbTestCase { + + public ArchetypeTest(String n) { + super(n); + } + + public void testArchetype() { + Archetype a = createArchetype("aid", "gid", "1.0"); + + assertEquals("aid", a.getArtifactId()); + assertEquals("gid", a.getGroupId()); + assertEquals("1.0", a.getVersion()); + assertEquals("aid", a.getName()); + assertNull(a.getDescription()); + assertNull(a.getRepository()); + + Archetype a2 = createArchetype("aid", "gid", "1.0"); + assertEquals(a, a2); + assertEquals(a.hashCode(), a2.hashCode()); + + a = createArchetype("aid", "gid", "1.0", "test", "test desc", "test repository"); + + assertEquals("aid", a.getArtifactId()); + assertEquals("gid", a.getGroupId()); + assertEquals("1.0", a.getVersion()); + assertEquals("test", a.getName()); + assertEquals("test desc", a.getDescription()); + assertEquals("test repository", a.getRepository()); + + a2 = createArchetype("aid", "gid", "1.0", "test", "test desc", "test repository"); + assertEquals(a, a2); + assertEquals(a.hashCode(), a2.hashCode()); + + } + + public void testGetName() { + Archetype a = createArchetype("aid", "gid", "1.0"); + assertEquals("aid", a.getName()); + + a = createArchetype("aid", "gid", "1.0", null, null, null); + assertEquals("aid", a.getName()); + + a = createArchetype("aid", "gid", "1.0", "${project.artifactId}", null, null); + assertEquals("aid", a.getName()); + + a = createArchetype("aid", "gid", "1.0", "test name", null, null); + assertEquals("test name", a.getName()); + } + + private Archetype createArchetype(String aid, String gid, String version) { + Archetype a = new Archetype(); + a.setArtifactId(aid); + a.setGroupId(gid); + a.setVersion(version); + return a; + } + + private Archetype createArchetype(String aid, String gid, String version, String name, String desc, String repo) { + Archetype a = new Archetype(); + a.setArtifactId(aid); + a.setGroupId(gid); + a.setVersion(version); + a.setName(name); + a.setDescription(desc); + a.setRepository(repo); + return a; + } + +} Index: api.maven.archetype/test/unit/src/org/netbeans/modules/maven/archetype/api/ProjectInfoTest.java --- api.maven.archetype/test/unit/src/org/netbeans/modules/maven/archetype/api/ProjectInfoTest.java +++ api.maven.archetype/test/unit/src/org/netbeans/modules/maven/archetype/api/ProjectInfoTest.java @@ -0,0 +1,63 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2011 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2011 Sun Microsystems, Inc. + */ + +package org.netbeans.modules.maven.archetype.api; + +import org.netbeans.api.maven.archetype.ProjectInfo; +import org.netbeans.junit.NbTestCase; + +public class ProjectInfoTest extends NbTestCase { + + public ProjectInfoTest(String n) { + super(n); + } + + public void testProjectInfo() { + ProjectInfo pi = new ProjectInfo("gid", "aid", "1.0", "package.name"); + assertEquals("gid", pi.getGroupId()); + assertEquals("aid", pi.getArtifactId()); + assertEquals("1.0", pi.getVersion()); + assertEquals("package.name", pi.getPackageName()); + } + + +} Index: maven/nbproject/project.xml --- maven/nbproject/project.xml +++ maven/nbproject/project.xml @@ -495,6 +495,7 @@ org.netbeans.modules.hudson.maven org.netbeans.modules.jbi.fuji.support org.netbeans.modules.kenai.maven + org.netbeans.api.maven.archetype org.netbeans.modules.maven.apisupport org.netbeans.modules.maven.checkstyle org.netbeans.modules.maven.coverage Index: nbbuild/build.properties --- nbbuild/build.properties +++ nbbuild/build.properties @@ -99,6 +99,7 @@ # List of modules that provide stable javadoc config.javadoc.stable=\ api.annotations.common,\ + api.maven.archetype,\ autoupdate.services,\ autoupdate.ui,\ core.ide,\ Index: nbbuild/cluster.properties --- nbbuild/cluster.properties +++ nbbuild/cluster.properties @@ -515,6 +515,7 @@ ant.kit,\ api.debugger.jpda,\ api.java,\ + api.maven.archetype,\ beans,\ classfile,\ dbschema,\