#IGNITE-124: Move classes from package org.apache.ignite.product to org.apache.ignite.internal.product. Class ProductVersion was moved to package org.apache.ignite.lang
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6df3ea93 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6df3ea93 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6df3ea93 Branch: refs/heads/ignite-24 Commit: 6df3ea9393b96a55d9ac20fe8136a5a3b4395b63 Parents: 9fd191a Author: ivasilinets <ivasilin...@gridgain.com> Authored: Mon Jan 26 12:29:00 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Mon Jan 26 12:29:00 2015 +0300 ---------------------------------------------------------------------- .../src/main/java/org/apache/ignite/Ignite.java | 2 +- .../org/apache/ignite/cluster/ClusterNode.java | 2 +- .../org/apache/ignite/internal/GridKernal.java | 2 +- .../ignite/internal/GridKernalContext.java | 2 +- .../ignite/internal/GridKernalContextImpl.java | 2 +- .../apache/ignite/internal/GridProductImpl.java | 6 +- .../ignite/internal/GridUpdateNotifier.java | 2 +- .../discovery/GridDiscoveryManager.java | 1 - .../dataload/IgniteDataLoaderImpl.java | 1 - .../processors/job/GridJobProcessor.java | 1 - .../license/GridLicenseProcessor.java | 6 +- .../license/os/GridOsLicenseProcessor.java | 2 +- .../ignite/internal/product/IgniteProduct.java | 67 +++++ .../internal/product/IgniteProductLicense.java | 183 ++++++++++++ .../product/IgniteProductLicenseException.java | 70 +++++ .../apache/ignite/internal/product/package.html | 23 ++ .../apache/ignite/internal/util/GridUtils.java | 1 - .../ignite/lang/IgniteProductVersion.java | 291 +++++++++++++++++++ .../apache/ignite/product/IgniteProduct.java | 66 ----- .../ignite/product/IgniteProductLicense.java | 183 ------------ .../product/IgniteProductLicenseException.java | 70 ----- .../ignite/product/IgniteProductVersion.java | 291 ------------------- .../java/org/apache/ignite/product/package.html | 23 -- .../communication/tcp/TcpCommunicationSpi.java | 1 - .../ignite/spi/discovery/DiscoverySpi.java | 2 +- .../discovery/tcp/TcpDiscoverySpiAdapter.java | 2 +- .../tcp/internal/TcpDiscoveryNode.java | 1 - .../ignite/internal/GridDiscoverySelfTest.java | 3 +- .../internal/GridReleaseTypeSelfTest.java | 3 +- .../GridTopologyBuildVersionSelfTest.java | 3 +- .../ignite/internal/GridVersionSelfTest.java | 2 +- ...unctionExcludeNeighborsAbstractSelfTest.java | 2 +- .../product/GridProductVersionSelfTest.java | 111 +++++++ .../marshaller/GridMarshallerAbstractTest.java | 2 +- .../ignite/p2p/GridP2PClassLoadingSelfTest.java | 4 +- .../product/GridProductVersionSelfTest.java | 111 ------- .../GridAbstractDiscoverySelfTest.java | 2 +- .../ignite/testframework/GridTestNode.java | 4 +- .../testframework/junits/GridTestIgnite.java | 2 +- .../junits/spi/GridSpiAbstractTest.java | 4 +- .../ignite/testsuites/IgniteBasicTestSuite.java | 2 +- .../org/apache/ignite/IgniteSpringBean.java | 2 +- 42 files changed, 776 insertions(+), 784 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/Ignite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/Ignite.java b/modules/core/src/main/java/org/apache/ignite/Ignite.java index 1565130..7340da1 100644 --- a/modules/core/src/main/java/org/apache/ignite/Ignite.java +++ b/modules/core/src/main/java/org/apache/ignite/Ignite.java @@ -22,7 +22,7 @@ import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.fs.IgniteFsConfiguration; import org.apache.ignite.plugin.*; -import org.apache.ignite.product.*; +import org.apache.ignite.internal.product.*; import org.apache.ignite.hadoop.*; import org.apache.ignite.plugin.security.*; import org.apache.ignite.internal.util.typedef.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java index 472c157..b5ed6aa 100644 --- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java +++ b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java @@ -19,7 +19,7 @@ package org.apache.ignite.cluster; import org.apache.ignite.*; import org.apache.ignite.internal.*; -import org.apache.ignite.product.*; +import org.apache.ignite.lang.*; import org.jetbrains.annotations.*; import java.util.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/internal/GridKernal.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernal.java index 608aa47..c3ae273 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernal.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernal.java @@ -31,7 +31,7 @@ import org.apache.ignite.marshaller.*; import org.apache.ignite.marshaller.optimized.*; import org.apache.ignite.mxbean.*; import org.apache.ignite.plugin.*; -import org.apache.ignite.product.*; +import org.apache.ignite.internal.product.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.authentication.*; import org.apache.ignite.spi.authentication.noop.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java index 21ba6d9..a7dd3aa 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java @@ -23,7 +23,7 @@ import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.fs.*; import org.apache.ignite.internal.processors.portable.*; import org.apache.ignite.plugin.*; -import org.apache.ignite.product.*; +import org.apache.ignite.internal.product.*; import org.apache.ignite.internal.managers.security.*; import org.apache.ignite.internal.managers.checkpoint.*; import org.apache.ignite.internal.managers.collision.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java index 4ec1bcc..8bb0085 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java @@ -24,7 +24,7 @@ import org.apache.ignite.internal.processors.fs.*; import org.apache.ignite.internal.processors.portable.*; import org.apache.ignite.internal.processors.streamer.*; import org.apache.ignite.plugin.*; -import org.apache.ignite.product.*; +import org.apache.ignite.internal.product.*; import org.apache.ignite.internal.managers.checkpoint.*; import org.apache.ignite.internal.managers.collision.*; import org.apache.ignite.internal.managers.communication.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/internal/GridProductImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridProductImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/GridProductImpl.java index 1de5d7d..7b9a0bb 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridProductImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridProductImpl.java @@ -17,8 +17,8 @@ package org.apache.ignite.internal; -import org.apache.ignite.internal.*; -import org.apache.ignite.product.*; +import org.apache.ignite.lang.*; +import org.apache.ignite.internal.product.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.jetbrains.annotations.*; @@ -27,7 +27,7 @@ import java.text.*; import java.util.*; /** - * {@link org.apache.ignite.product.IgniteProduct} implementation. + * {@link org.apache.ignite.internal.product.IgniteProduct} implementation. */ public class GridProductImpl implements IgniteProduct, Externalizable { /** */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java b/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java index df8cf57..9720a60 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java @@ -18,7 +18,7 @@ package org.apache.ignite.internal; import org.apache.ignite.*; -import org.apache.ignite.product.*; +import org.apache.ignite.internal.product.*; import org.apache.ignite.internal.processors.license.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java index 5d45370..50ff00e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java @@ -27,7 +27,6 @@ import org.apache.ignite.lang.*; import org.apache.ignite.plugin.extensions.discovery.*; import org.apache.ignite.plugin.security.*; import org.apache.ignite.plugin.segmentation.*; -import org.apache.ignite.product.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.discovery.*; import org.apache.ignite.thread.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java index bb98e31..4b1f50c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java @@ -27,7 +27,6 @@ import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.portable.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; -import org.apache.ignite.product.*; import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.managers.deployment.*; import org.apache.ignite.internal.managers.eventstorage.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java index 416d756..477e742 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java @@ -26,7 +26,6 @@ import org.apache.ignite.internal.processors.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.marshaller.*; -import org.apache.ignite.product.*; import org.apache.ignite.internal.managers.collision.*; import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.managers.deployment.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/internal/processors/license/GridLicenseProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/license/GridLicenseProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/license/GridLicenseProcessor.java index 353d2d8..6d30b69 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/license/GridLicenseProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/license/GridLicenseProcessor.java @@ -18,7 +18,7 @@ package org.apache.ignite.internal.processors.license; import org.apache.ignite.internal.processors.*; -import org.apache.ignite.product.*; +import org.apache.ignite.internal.product.*; import org.jetbrains.annotations.*; /** @@ -29,7 +29,7 @@ public interface GridLicenseProcessor extends GridProcessor { * Upload the new license into the current node. * * @param licTxt The string representation of the license file. - * @throws org.apache.ignite.product.IgniteProductLicenseException Thrown if validation check failed for specified license or + * @throws org.apache.ignite.internal.product.IgniteProductLicenseException Thrown if validation check failed for specified license or * license can not be updated because configured license URL use non-file scheme. * @see org.apache.ignite.configuration.IgniteConfiguration#getLicenseUrl() */ @@ -43,7 +43,7 @@ public interface GridLicenseProcessor extends GridProcessor { /** * This method is called periodically by the GridGain to check the license conformance. * - * @throws org.apache.ignite.product.IgniteProductLicenseException Thrown in case of any license violation. + * @throws org.apache.ignite.internal.product.IgniteProductLicenseException Thrown in case of any license violation. */ public void checkLicense() throws IgniteProductLicenseException; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/internal/processors/license/os/GridOsLicenseProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/license/os/GridOsLicenseProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/license/os/GridOsLicenseProcessor.java index 807d798..3023935 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/license/os/GridOsLicenseProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/license/os/GridOsLicenseProcessor.java @@ -19,7 +19,7 @@ package org.apache.ignite.internal.processors.license.os; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.*; -import org.apache.ignite.product.*; +import org.apache.ignite.internal.product.*; import org.apache.ignite.internal.processors.license.*; import org.jetbrains.annotations.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/internal/product/IgniteProduct.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/product/IgniteProduct.java b/modules/core/src/main/java/org/apache/ignite/internal/product/IgniteProduct.java new file mode 100644 index 0000000..701a050 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/product/IgniteProduct.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.product; + +import org.apache.ignite.lang.*; +import org.jetbrains.annotations.*; + +/** + * Provides information about current release. Note that enterprise users are also + * able to renew license. Instance of {@code GridProduct} is obtained from grid as follows: + * <pre name="code" class="java"> + * GridProduct p = GridGain.grid().product(); + * </pre> + */ +public interface IgniteProduct { + /** + * Gets license descriptor for enterprise edition or {@code null} for open source edition. + * + * @return License descriptor. + */ + @Nullable public IgniteProductLicense license(); + + /** + * Updates to a new license in enterprise edition. This method is no-op in open source edition. + * + * @param lic The content of the license. + * @throws IgniteProductLicenseException If license could not be updated. + */ + public void updateLicense(String lic) throws IgniteProductLicenseException; + + /** + * Gets product version for this release. + * + * @return Product version for this release. + */ + public IgniteProductVersion version(); + + /** + * Copyright statement for GridGain code. + * + * @return Legal copyright statement for GridGain code. + */ + public String copyright(); + + /** + * Gets latest version available for download or + * {@code null} if information is not available. + * + * @return Latest version string or {@code null} if information is not available. + */ + @Nullable public String latestVersion(); +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/internal/product/IgniteProductLicense.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/product/IgniteProductLicense.java b/modules/core/src/main/java/org/apache/ignite/internal/product/IgniteProductLicense.java new file mode 100644 index 0000000..137957d --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/product/IgniteProductLicense.java @@ -0,0 +1,183 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.product; + +import org.jetbrains.annotations.*; + +import java.io.*; +import java.util.*; + +/** + * GridGain license descriptor. GridGain license is available for + * information purposes and is checked automatically by GridGain software. + * License descriptor can be obtains by calling {@link IgniteProduct#license()} method. + * @see IgniteProduct#license() + */ +public interface IgniteProductLicense extends Serializable { + /** + * Gets a comma separated list of disabled subsystems. + * + * @return Comma separated list of disabled subsystems or {@code null}. + */ + public String disabledSubsystems(); + + /** + * Gets license version. + * + * @return License version. + */ + public String version(); + + /** + * Gets license ID. + * + * @return License ID. + */ + public UUID id(); + + /** + * Version regular expression. + * + * @return Version regular expression. + */ + public String versionRegexp(); + + /** + * Gets issue date. + * + * @return Issue date. + */ + public Date issueDate(); + + /** + * Gets maintenance time in months. If zero - no restriction. + * + * @return Maintenance time. + */ + public int maintenanceTime(); + + /** + * Gets issue organization. + * + * @return Issue organization. + */ + public String issueOrganization(); + + /** + * Gets user organization. + * + * @return User organization. + */ + public String userOrganization(); + + /** + * Gets license note. It may include textual description of license limitations such + * as as "Development Only" or "Load-Testing and Staging Only". + * + * @return License note. + */ + public String licenseNote(); + + /** + * Gets user organization URL. + * + * @return User organization URL. + */ + public String userWww(); + + /** + * Gets user organization e-mail. + * + * @return User organization e-mail. + */ + public String userEmail(); + + /** + * Gets user organization contact name. + * + * @return User organization contact name. + */ + public String userName(); + + /** + * Gets expire date. + * + * @return Expire date. + */ + public Date expireDate(); + + /** + * Gets maximum number of nodes. If zero - no restriction. + * + * @return Maximum number of nodes. + */ + public int maxNodes(); + + /** + * Gets maximum number of physical computers or virtual instances. If zero - no restriction. + * Note that individual physical computer or virtual instance is determined by number of enabled + * MACs on each computer or instance. + * + * @return Maximum number of computers or virtual instances. + */ + public int maxComputers(); + + /** + * Gets maximum number of CPUs. If zero - no restriction. + * + * @return Maximum number of CPUs. + */ + public int maxCpus(); + + /** + * Gets maximum up time in minutes. If zero - no restriction. + * + * @return Maximum up time in minutes. + */ + public long maxUpTime(); + + /** + * Gets license violation grace period in minutes. If zero - no grace period. + * + * @return License violation grace period in minutes. + */ + public long gracePeriod(); + + /** + * Gets license attribute name if any. Attributes in license will have to match + * attributes in the grid node. + * + * @return Attribute name. + */ + @Nullable public String attributeName(); + + /** + * Gets value for the license attribute if any. Attributes in license will have to match + * attributes in the grid node. + * + * @return Attribute value. + */ + @Nullable public String attributeValue(); + + /** + * Gets a comma separated list of allowed cache distribution modes. + * + * @return Allowed cache distribution modes or {@code null}. + */ + @Nullable public String getCacheDistributionModes(); +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/internal/product/IgniteProductLicenseException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/product/IgniteProductLicenseException.java b/modules/core/src/main/java/org/apache/ignite/internal/product/IgniteProductLicenseException.java new file mode 100644 index 0000000..71c3021 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/product/IgniteProductLicenseException.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.product; + +import org.apache.ignite.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.jetbrains.annotations.*; + +/** + * This exception is thrown when license violation is detected. + */ +public class IgniteProductLicenseException extends IgniteCheckedException { + /** */ + private static final long serialVersionUID = 0L; + + /** Short message. */ + private final String shortMsg; + + /** + * Creates new license exception with given error message. + * + * @param msg Error message. + * @param shortMsg Short error message presentable to the user. Note it should contain just letter and dot. + */ + public IgniteProductLicenseException(String msg, @Nullable String shortMsg) { + super(msg); + + this.shortMsg = shortMsg; + } + + /** + * Creates new license exception with given error message and optional nested exception. + * + * @param msg Error message. + * @param shortMsg Short error message presentable to the user. Note it should contain just letter and dot. + * @param cause Optional nested exception (can be {@code null}). + */ + public IgniteProductLicenseException(String msg, @Nullable String shortMsg, @Nullable Throwable cause) { + super(msg, cause); + + this.shortMsg = shortMsg; + } + + /** + * @return shortMessage Short error message presentable to the user. Note it should contain just letter and dot. + */ + public final String shortMessage() { + return shortMsg; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(IgniteProductLicenseException.class, this, "msg", getMessage(), "shortMsg", shortMsg); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/internal/product/package.html ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/product/package.html b/modules/core/src/main/java/org/apache/ignite/internal/product/package.html new file mode 100644 index 0000000..a24615b --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/product/package.html @@ -0,0 +1,23 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<body> + <!-- Package description. --> + Contains <b>Product</b> and <b>License</b> related functionality. +</body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/internal/util/GridUtils.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridUtils.java index 6ec7f32..5279b59 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridUtils.java @@ -29,7 +29,6 @@ import org.apache.ignite.lang.*; import org.apache.ignite.lifecycle.*; import org.apache.ignite.mxbean.*; import org.apache.ignite.portables.*; -import org.apache.ignite.product.*; import org.apache.ignite.spi.*; import org.apache.ignite.internal.managers.deployment.*; import org.apache.ignite.internal.processors.streamer.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java b/modules/core/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java new file mode 100644 index 0000000..44135fc --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java @@ -0,0 +1,291 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.lang; + +import org.apache.ignite.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.jetbrains.annotations.*; + +import java.io.*; +import java.text.*; +import java.util.*; +import java.util.regex.*; + +/** + * Represents node version. + * <p> + * Node version can be acquired via {@link org.apache.ignite.cluster.ClusterNode#version()} method. + * <p> + * Two versions are compared in the following order: major number, + * minor number, maintenance number, revision timestamp. + */ +public class IgniteProductVersion implements Comparable<IgniteProductVersion>, Externalizable { + /** */ + private static final long serialVersionUID = 0L; + + /** Regexp parse pattern. */ + private static final Pattern VER_PATTERN = + Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)((?!-(os|ent))-([^-]+))?(-(os|ent))?(-(\\d+))?(-([\\da-f]+))?"); + + /** Major version number. */ + private byte major; + + /** Minor version number. */ + private byte minor; + + /** Maintenance version number. */ + private byte maintenance; + + /** Stage of development. */ + private String stage; + + /** Revision timestamp. */ + private long revTs; + + /** Revision hash. */ + private byte[] revHash; + + /** + * Empty constructor required by {@link Externalizable}. + */ + public IgniteProductVersion() { + // No-op. + } + + /** + * @param major Major version number. + * @param minor Minor version number. + * @param maintenance Maintenance version number. + * @param revTs Revision timestamp. + * @param revHash Revision hash. + */ + public IgniteProductVersion(byte major, byte minor, byte maintenance, long revTs, byte[] revHash) { + this(major, minor, maintenance, "", revTs, revHash); + } + + /** + * @param major Major version number. + * @param minor Minor version number. + * @param maintenance Maintenance version number. + * @param stage Stage of development. + * @param revTs Revision timestamp. + * @param revHash Revision hash. + */ + public IgniteProductVersion(byte major, byte minor, byte maintenance, String stage, long revTs, byte[] revHash) { + if (revHash != null && revHash.length != 20) + throw new IllegalArgumentException("Invalid length for SHA1 hash (must be 20): " + revHash.length); + + this.major = major; + this.minor = minor; + this.maintenance = maintenance; + this.stage = stage; + this.revTs = revTs; + this.revHash = revHash != null ? revHash : new byte[20]; + } + + /** + * Gets major version number. + * + * @return Major version number. + */ + public byte major() { + return major; + } + + /** + * Gets minor version number. + * + * @return Minor version number. + */ + public byte minor() { + return minor; + } + + /** + * Gets maintenance version number. + * + * @return Maintenance version number. + */ + public byte maintenance() { + return maintenance; + } + + /** + * @return Stage of development. + */ + public String stage() { + return stage; + } + + /** + * Gets revision timestamp. + * + * @return Revision timestamp. + */ + public long revisionTimestamp() { + return revTs; + } + + /** + * Gets revision hash. + * + * @return Revision hash. + */ + public byte[] revisionHash() { + return revHash; + } + + /** + * Gets release date. + * + * @return Release date. + */ + public Date releaseDate() { + return new Date(revTs); + } + + /** + * @param major Major version number. + * @param minor Minor version number. + * @param maintenance Maintenance version number. + * @return {@code True} if this version is greater or equal than the one passed in. + */ + public boolean greaterThanEqual(int major, int minor, int maintenance) { + // NOTE: Unknown version is less than any other version. + if (major == this.major) + return minor == this.minor ? this.maintenance >= maintenance : this.minor > minor; + else + return this.major > major; + } + + /** {@inheritDoc} */ + @Override public int compareTo(@NotNull IgniteProductVersion o) { + // NOTE: Unknown version is less than any other version. + if (major == o.major) { + if (minor == o.minor) { + if (maintenance == o.maintenance) + return revTs != o.revTs ? revTs < o.revTs ? -1 : 1 : 0; + else + return maintenance < o.maintenance ? -1 : 1; + } + else + return minor < o.minor ? -1 : 1; + } + else + return major < o.major ? -1 : 1; + } + + /** {@inheritDoc} */ + @Override public boolean equals(Object o) { + if (this == o) + return true; + + if (!(o instanceof IgniteProductVersion)) + return false; + + IgniteProductVersion that = (IgniteProductVersion)o; + + return revTs == that.revTs && maintenance == that.maintenance && minor == that.minor && major == that.major; + } + + /** {@inheritDoc} */ + @Override public int hashCode() { + int res = major; + + res = 31 * res + minor; + res = 31 * res + maintenance; + res = 31 * res + (int)(revTs ^ (revTs >>> 32)); + + return res; + } + + /** {@inheritDoc} */ + @Override public void writeExternal(ObjectOutput out) throws IOException { + out.writeByte(major); + out.writeByte(minor); + out.writeByte(maintenance); + out.writeLong(revTs); + U.writeByteArray(out, revHash); + } + + /** {@inheritDoc} */ + @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { + major = in.readByte(); + minor = in.readByte(); + maintenance = in.readByte(); + revTs = in.readLong(); + revHash = U.readByteArray(in); + } + + /** {@inheritDoc} */ + public String toString() { + String revTsStr = new SimpleDateFormat("yyyyMMdd").format(new Date(revTs * 1000)); + + String hash = U.byteArray2HexString(revHash).toLowerCase(); + + hash = hash.length() > 8 ? hash.substring(0, 8) : hash; + + return major + "." + minor + "." + maintenance + "#" + revTsStr + "-sha1:" + hash; + } + + /** + * Tries to parse product version from it's string representation. + * + * @param verStr String representation of version. + * @return Product version. + */ + @SuppressWarnings({"MagicConstant", "TypeMayBeWeakened"}) + public static IgniteProductVersion fromString(String verStr) { + assert verStr != null; + + if (verStr.endsWith("-DEV")) // Development version, just cut it out. + verStr = verStr.substring(0, verStr.length() - 4); + + Matcher match = VER_PATTERN.matcher(verStr); + + if (match.matches()) { + try { + byte major = Byte.parseByte(match.group(1)); + byte minor = Byte.parseByte(match.group(2)); + byte maintenance = Byte.parseByte(match.group(3)); + + String stage = ""; + + if (match.group(4) != null) + stage = match.group(6); + + long revTs = 0; + + if (match.group(9) != null) + revTs = Long.parseLong(match.group(10)); + + byte[] revHash = null; + + if (match.group(11) != null) + revHash = U.decodeHex(match.group(12).toCharArray()); + + return new IgniteProductVersion(major, minor, maintenance, stage, revTs, revHash); + } + catch (IllegalStateException | IndexOutOfBoundsException | NumberFormatException | IgniteCheckedException e) { + throw new IllegalStateException("Failed to parse version: " + verStr, e); + } + } + else + throw new IllegalStateException("Failed to parse version: " + verStr); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/product/IgniteProduct.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/product/IgniteProduct.java b/modules/core/src/main/java/org/apache/ignite/product/IgniteProduct.java deleted file mode 100644 index 5a024c2..0000000 --- a/modules/core/src/main/java/org/apache/ignite/product/IgniteProduct.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.product; - -import org.jetbrains.annotations.*; - -/** - * Provides information about current release. Note that enterprise users are also - * able to renew license. Instance of {@code GridProduct} is obtained from grid as follows: - * <pre name="code" class="java"> - * GridProduct p = GridGain.grid().product(); - * </pre> - */ -public interface IgniteProduct { - /** - * Gets license descriptor for enterprise edition or {@code null} for open source edition. - * - * @return License descriptor. - */ - @Nullable public IgniteProductLicense license(); - - /** - * Updates to a new license in enterprise edition. This method is no-op in open source edition. - * - * @param lic The content of the license. - * @throws IgniteProductLicenseException If license could not be updated. - */ - public void updateLicense(String lic) throws IgniteProductLicenseException; - - /** - * Gets product version for this release. - * - * @return Product version for this release. - */ - public IgniteProductVersion version(); - - /** - * Copyright statement for GridGain code. - * - * @return Legal copyright statement for GridGain code. - */ - public String copyright(); - - /** - * Gets latest version available for download or - * {@code null} if information is not available. - * - * @return Latest version string or {@code null} if information is not available. - */ - @Nullable public String latestVersion(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/product/IgniteProductLicense.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/product/IgniteProductLicense.java b/modules/core/src/main/java/org/apache/ignite/product/IgniteProductLicense.java deleted file mode 100644 index 213987e..0000000 --- a/modules/core/src/main/java/org/apache/ignite/product/IgniteProductLicense.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.product; - -import org.jetbrains.annotations.*; - -import java.io.*; -import java.util.*; - -/** - * GridGain license descriptor. GridGain license is available for - * information purposes and is checked automatically by GridGain software. - * License descriptor can be obtains by calling {@link IgniteProduct#license()} method. - * @see IgniteProduct#license() - */ -public interface IgniteProductLicense extends Serializable { - /** - * Gets a comma separated list of disabled subsystems. - * - * @return Comma separated list of disabled subsystems or {@code null}. - */ - public String disabledSubsystems(); - - /** - * Gets license version. - * - * @return License version. - */ - public String version(); - - /** - * Gets license ID. - * - * @return License ID. - */ - public UUID id(); - - /** - * Version regular expression. - * - * @return Version regular expression. - */ - public String versionRegexp(); - - /** - * Gets issue date. - * - * @return Issue date. - */ - public Date issueDate(); - - /** - * Gets maintenance time in months. If zero - no restriction. - * - * @return Maintenance time. - */ - public int maintenanceTime(); - - /** - * Gets issue organization. - * - * @return Issue organization. - */ - public String issueOrganization(); - - /** - * Gets user organization. - * - * @return User organization. - */ - public String userOrganization(); - - /** - * Gets license note. It may include textual description of license limitations such - * as as "Development Only" or "Load-Testing and Staging Only". - * - * @return License note. - */ - public String licenseNote(); - - /** - * Gets user organization URL. - * - * @return User organization URL. - */ - public String userWww(); - - /** - * Gets user organization e-mail. - * - * @return User organization e-mail. - */ - public String userEmail(); - - /** - * Gets user organization contact name. - * - * @return User organization contact name. - */ - public String userName(); - - /** - * Gets expire date. - * - * @return Expire date. - */ - public Date expireDate(); - - /** - * Gets maximum number of nodes. If zero - no restriction. - * - * @return Maximum number of nodes. - */ - public int maxNodes(); - - /** - * Gets maximum number of physical computers or virtual instances. If zero - no restriction. - * Note that individual physical computer or virtual instance is determined by number of enabled - * MACs on each computer or instance. - * - * @return Maximum number of computers or virtual instances. - */ - public int maxComputers(); - - /** - * Gets maximum number of CPUs. If zero - no restriction. - * - * @return Maximum number of CPUs. - */ - public int maxCpus(); - - /** - * Gets maximum up time in minutes. If zero - no restriction. - * - * @return Maximum up time in minutes. - */ - public long maxUpTime(); - - /** - * Gets license violation grace period in minutes. If zero - no grace period. - * - * @return License violation grace period in minutes. - */ - public long gracePeriod(); - - /** - * Gets license attribute name if any. Attributes in license will have to match - * attributes in the grid node. - * - * @return Attribute name. - */ - @Nullable public String attributeName(); - - /** - * Gets value for the license attribute if any. Attributes in license will have to match - * attributes in the grid node. - * - * @return Attribute value. - */ - @Nullable public String attributeValue(); - - /** - * Gets a comma separated list of allowed cache distribution modes. - * - * @return Allowed cache distribution modes or {@code null}. - */ - @Nullable public String getCacheDistributionModes(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/product/IgniteProductLicenseException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/product/IgniteProductLicenseException.java b/modules/core/src/main/java/org/apache/ignite/product/IgniteProductLicenseException.java deleted file mode 100644 index a7c9f2a..0000000 --- a/modules/core/src/main/java/org/apache/ignite/product/IgniteProductLicenseException.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.product; - -import org.apache.ignite.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.jetbrains.annotations.*; - -/** - * This exception is thrown when license violation is detected. - */ -public class IgniteProductLicenseException extends IgniteCheckedException { - /** */ - private static final long serialVersionUID = 0L; - - /** Short message. */ - private final String shortMsg; - - /** - * Creates new license exception with given error message. - * - * @param msg Error message. - * @param shortMsg Short error message presentable to the user. Note it should contain just letter and dot. - */ - public IgniteProductLicenseException(String msg, @Nullable String shortMsg) { - super(msg); - - this.shortMsg = shortMsg; - } - - /** - * Creates new license exception with given error message and optional nested exception. - * - * @param msg Error message. - * @param shortMsg Short error message presentable to the user. Note it should contain just letter and dot. - * @param cause Optional nested exception (can be {@code null}). - */ - public IgniteProductLicenseException(String msg, @Nullable String shortMsg, @Nullable Throwable cause) { - super(msg, cause); - - this.shortMsg = shortMsg; - } - - /** - * @return shortMessage Short error message presentable to the user. Note it should contain just letter and dot. - */ - public final String shortMessage() { - return shortMsg; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteProductLicenseException.class, this, "msg", getMessage(), "shortMsg", shortMsg); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/product/IgniteProductVersion.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/product/IgniteProductVersion.java b/modules/core/src/main/java/org/apache/ignite/product/IgniteProductVersion.java deleted file mode 100644 index a650a8b..0000000 --- a/modules/core/src/main/java/org/apache/ignite/product/IgniteProductVersion.java +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.product; - -import org.apache.ignite.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.jetbrains.annotations.*; - -import java.io.*; -import java.text.*; -import java.util.*; -import java.util.regex.*; - -/** - * Represents node version. - * <p> - * Node version can be acquired via {@link org.apache.ignite.cluster.ClusterNode#version()} method. - * <p> - * Two versions are compared in the following order: major number, - * minor number, maintenance number, revision timestamp. - */ -public class IgniteProductVersion implements Comparable<IgniteProductVersion>, Externalizable { - /** */ - private static final long serialVersionUID = 0L; - - /** Regexp parse pattern. */ - private static final Pattern VER_PATTERN = - Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)((?!-(os|ent))-([^-]+))?(-(os|ent))?(-(\\d+))?(-([\\da-f]+))?"); - - /** Major version number. */ - private byte major; - - /** Minor version number. */ - private byte minor; - - /** Maintenance version number. */ - private byte maintenance; - - /** Stage of development. */ - private String stage; - - /** Revision timestamp. */ - private long revTs; - - /** Revision hash. */ - private byte[] revHash; - - /** - * Empty constructor required by {@link Externalizable}. - */ - public IgniteProductVersion() { - // No-op. - } - - /** - * @param major Major version number. - * @param minor Minor version number. - * @param maintenance Maintenance version number. - * @param revTs Revision timestamp. - * @param revHash Revision hash. - */ - public IgniteProductVersion(byte major, byte minor, byte maintenance, long revTs, byte[] revHash) { - this(major, minor, maintenance, "", revTs, revHash); - } - - /** - * @param major Major version number. - * @param minor Minor version number. - * @param maintenance Maintenance version number. - * @param stage Stage of development. - * @param revTs Revision timestamp. - * @param revHash Revision hash. - */ - public IgniteProductVersion(byte major, byte minor, byte maintenance, String stage, long revTs, byte[] revHash) { - if (revHash != null && revHash.length != 20) - throw new IllegalArgumentException("Invalid length for SHA1 hash (must be 20): " + revHash.length); - - this.major = major; - this.minor = minor; - this.maintenance = maintenance; - this.stage = stage; - this.revTs = revTs; - this.revHash = revHash != null ? revHash : new byte[20]; - } - - /** - * Gets major version number. - * - * @return Major version number. - */ - public byte major() { - return major; - } - - /** - * Gets minor version number. - * - * @return Minor version number. - */ - public byte minor() { - return minor; - } - - /** - * Gets maintenance version number. - * - * @return Maintenance version number. - */ - public byte maintenance() { - return maintenance; - } - - /** - * @return Stage of development. - */ - public String stage() { - return stage; - } - - /** - * Gets revision timestamp. - * - * @return Revision timestamp. - */ - public long revisionTimestamp() { - return revTs; - } - - /** - * Gets revision hash. - * - * @return Revision hash. - */ - public byte[] revisionHash() { - return revHash; - } - - /** - * Gets release date. - * - * @return Release date. - */ - public Date releaseDate() { - return new Date(revTs); - } - - /** - * @param major Major version number. - * @param minor Minor version number. - * @param maintenance Maintenance version number. - * @return {@code True} if this version is greater or equal than the one passed in. - */ - public boolean greaterThanEqual(int major, int minor, int maintenance) { - // NOTE: Unknown version is less than any other version. - if (major == this.major) - return minor == this.minor ? this.maintenance >= maintenance : this.minor > minor; - else - return this.major > major; - } - - /** {@inheritDoc} */ - @Override public int compareTo(@NotNull IgniteProductVersion o) { - // NOTE: Unknown version is less than any other version. - if (major == o.major) { - if (minor == o.minor) { - if (maintenance == o.maintenance) - return revTs != o.revTs ? revTs < o.revTs ? -1 : 1 : 0; - else - return maintenance < o.maintenance ? -1 : 1; - } - else - return minor < o.minor ? -1 : 1; - } - else - return major < o.major ? -1 : 1; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (!(o instanceof IgniteProductVersion)) - return false; - - IgniteProductVersion that = (IgniteProductVersion)o; - - return revTs == that.revTs && maintenance == that.maintenance && minor == that.minor && major == that.major; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int res = major; - - res = 31 * res + minor; - res = 31 * res + maintenance; - res = 31 * res + (int)(revTs ^ (revTs >>> 32)); - - return res; - } - - /** {@inheritDoc} */ - @Override public void writeExternal(ObjectOutput out) throws IOException { - out.writeByte(major); - out.writeByte(minor); - out.writeByte(maintenance); - out.writeLong(revTs); - U.writeByteArray(out, revHash); - } - - /** {@inheritDoc} */ - @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - major = in.readByte(); - minor = in.readByte(); - maintenance = in.readByte(); - revTs = in.readLong(); - revHash = U.readByteArray(in); - } - - /** {@inheritDoc} */ - public String toString() { - String revTsStr = new SimpleDateFormat("yyyyMMdd").format(new Date(revTs * 1000)); - - String hash = U.byteArray2HexString(revHash).toLowerCase(); - - hash = hash.length() > 8 ? hash.substring(0, 8) : hash; - - return major + "." + minor + "." + maintenance + "#" + revTsStr + "-sha1:" + hash; - } - - /** - * Tries to parse product version from it's string representation. - * - * @param verStr String representation of version. - * @return Product version. - */ - @SuppressWarnings({"MagicConstant", "TypeMayBeWeakened"}) - public static IgniteProductVersion fromString(String verStr) { - assert verStr != null; - - if (verStr.endsWith("-DEV")) // Development version, just cut it out. - verStr = verStr.substring(0, verStr.length() - 4); - - Matcher match = VER_PATTERN.matcher(verStr); - - if (match.matches()) { - try { - byte major = Byte.parseByte(match.group(1)); - byte minor = Byte.parseByte(match.group(2)); - byte maintenance = Byte.parseByte(match.group(3)); - - String stage = ""; - - if (match.group(4) != null) - stage = match.group(6); - - long revTs = 0; - - if (match.group(9) != null) - revTs = Long.parseLong(match.group(10)); - - byte[] revHash = null; - - if (match.group(11) != null) - revHash = U.decodeHex(match.group(12).toCharArray()); - - return new IgniteProductVersion(major, minor, maintenance, stage, revTs, revHash); - } - catch (IllegalStateException | IndexOutOfBoundsException | NumberFormatException | IgniteCheckedException e) { - throw new IllegalStateException("Failed to parse version: " + verStr, e); - } - } - else - throw new IllegalStateException("Failed to parse version: " + verStr); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/product/package.html ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/product/package.html b/modules/core/src/main/java/org/apache/ignite/product/package.html deleted file mode 100644 index a24615b..0000000 --- a/modules/core/src/main/java/org/apache/ignite/product/package.html +++ /dev/null @@ -1,23 +0,0 @@ -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - --> -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> -<body> - <!-- Package description. --> - Contains <b>Product</b> and <b>License</b> related functionality. -</body> -</html> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java index 828aaa0..4e9369a 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java @@ -23,7 +23,6 @@ import org.apache.ignite.configuration.*; import org.apache.ignite.events.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; -import org.apache.ignite.product.*; import org.apache.ignite.resources.*; import org.apache.ignite.spi.*; import org.apache.ignite.thread.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpi.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpi.java index 02e8f14..168cfc5 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpi.java @@ -18,7 +18,7 @@ package org.apache.ignite.spi.discovery; import org.apache.ignite.cluster.*; -import org.apache.ignite.product.*; +import org.apache.ignite.lang.*; import org.apache.ignite.spi.*; import org.jetbrains.annotations.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java index 0f40bda..9196d71 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java @@ -20,9 +20,9 @@ package org.apache.ignite.spi.discovery.tcp; import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.util.*; +import org.apache.ignite.lang.*; import org.apache.ignite.marshaller.*; import org.apache.ignite.marshaller.jdk.*; -import org.apache.ignite.product.*; import org.apache.ignite.resources.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.discovery.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java index e628ecc..3c4beea 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java @@ -20,7 +20,6 @@ package org.apache.ignite.spi.discovery.tcp.internal; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.*; import org.apache.ignite.lang.*; -import org.apache.ignite.product.*; import org.apache.ignite.spi.discovery.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.tostring.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoverySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoverySelfTest.java index 27dc641..3e24e8e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoverySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoverySelfTest.java @@ -23,7 +23,6 @@ import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.events.*; import org.apache.ignite.lang.*; -import org.apache.ignite.product.*; import org.apache.ignite.internal.managers.discovery.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; @@ -38,7 +37,7 @@ import java.util.concurrent.*; import java.util.concurrent.atomic.*; import static java.util.concurrent.TimeUnit.*; -import static org.apache.ignite.product.IgniteProductVersion.*; +import static org.apache.ignite.lang.IgniteProductVersion.*; import static org.apache.ignite.events.IgniteEventType.*; /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java index f58992f..158491b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java @@ -19,8 +19,7 @@ package org.apache.ignite.internal; import org.apache.ignite.*; import org.apache.ignite.configuration.*; -import org.apache.ignite.internal.*; -import org.apache.ignite.product.*; +import org.apache.ignite.lang.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/test/java/org/apache/ignite/internal/GridTopologyBuildVersionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridTopologyBuildVersionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridTopologyBuildVersionSelfTest.java index 6e701e1..686640c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/GridTopologyBuildVersionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/GridTopologyBuildVersionSelfTest.java @@ -19,8 +19,7 @@ package org.apache.ignite.internal; import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; -import org.apache.ignite.internal.*; -import org.apache.ignite.product.*; +import org.apache.ignite.lang.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/test/java/org/apache/ignite/internal/GridVersionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridVersionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridVersionSelfTest.java index 57cfd4e..bc1a9e8 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/GridVersionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/GridVersionSelfTest.java @@ -18,7 +18,7 @@ package org.apache.ignite.internal; import org.apache.ignite.*; -import org.apache.ignite.product.*; +import org.apache.ignite.lang.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.testframework.junits.common.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAffinityFunctionExcludeNeighborsAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAffinityFunctionExcludeNeighborsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAffinityFunctionExcludeNeighborsAbstractSelfTest.java index fabce7f..4cc7120 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAffinityFunctionExcludeNeighborsAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAffinityFunctionExcludeNeighborsAbstractSelfTest.java @@ -23,7 +23,7 @@ import org.apache.ignite.cache.affinity.*; import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; -import org.apache.ignite.product.*; +import org.apache.ignite.lang.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.internal.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/test/java/org/apache/ignite/internal/product/GridProductVersionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/product/GridProductVersionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/product/GridProductVersionSelfTest.java new file mode 100644 index 0000000..bd031bd --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/product/GridProductVersionSelfTest.java @@ -0,0 +1,111 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.product; + +import org.apache.ignite.lang.*; +import org.apache.ignite.testframework.junits.common.*; + +import static org.junit.Assert.*; +import static org.apache.ignite.internal.GridProductImpl.*; + +/** + * Versions test. + */ +public class GridProductVersionSelfTest extends GridCommonAbstractTest { + /** + * @throws Exception If failed. + */ + public void testFromString() throws Exception { + IgniteProductVersion ver = IgniteProductVersion.fromString("1.2.3"); + + assertEquals(1, ver.major()); + assertEquals(2, ver.minor()); + assertEquals(3, ver.maintenance()); + assertEquals("", ver.stage()); + assertEquals(0, ver.revisionTimestamp()); + assertArrayEquals(new byte[20], ver.revisionHash()); + + ver = IgniteProductVersion.fromString("1.2.3-ent-0-DEV"); + + assertEquals(1, ver.major()); + assertEquals(2, ver.minor()); + assertEquals(3, ver.maintenance()); + assertEquals(0, ver.revisionTimestamp()); + assertArrayEquals(new byte[20], ver.revisionHash()); + + ver = IgniteProductVersion.fromString("1.2.3-rc1-os-4-DEV"); + + assertEquals(1, ver.major()); + assertEquals(2, ver.minor()); + assertEquals(3, ver.maintenance()); + assertEquals("rc1", ver.stage()); + assertEquals(4, ver.revisionTimestamp()); + assertArrayEquals(new byte[20], ver.revisionHash()); + + ver = IgniteProductVersion.fromString("1.2.3-GA1-4-DEV"); + + assertEquals(1, ver.major()); + assertEquals(2, ver.minor()); + assertEquals(3, ver.maintenance()); + assertEquals("GA1", ver.stage()); + assertEquals(4, ver.revisionTimestamp()); + assertArrayEquals(new byte[20], ver.revisionHash()); + + ver = IgniteProductVersion.fromString("1.2.3-ent"); + + assertEquals(1, ver.major()); + assertEquals(2, ver.minor()); + assertEquals(3, ver.maintenance()); + assertEquals("", ver.stage()); + assertEquals(0, ver.revisionTimestamp()); + assertArrayEquals(new byte[20], ver.revisionHash()); + + ver = IgniteProductVersion.fromString("1.2.3-os-4"); + + assertEquals(1, ver.major()); + assertEquals(2, ver.minor()); + assertEquals(3, ver.maintenance()); + assertEquals("", ver.stage()); + assertEquals(4, ver.revisionTimestamp()); + assertArrayEquals(new byte[20], ver.revisionHash()); + + ver = IgniteProductVersion.fromString("1.2.3-ent-4-18e5a7ec9e3202126a69bc231a6b965bc1d73dee"); + + assertEquals(1, ver.major()); + assertEquals(2, ver.minor()); + assertEquals(3, ver.maintenance()); + assertEquals("", ver.stage()); + assertEquals(4, ver.revisionTimestamp()); + assertArrayEquals(new byte[]{24, -27, -89, -20, -98, 50, 2, 18, 106, 105, -68, 35, 26, 107, -106, 91, -63, -41, 61, -18}, + ver.revisionHash()); + + ver = IgniteProductVersion.fromString("1.2.3-rc1-os-4-18e5a7ec9e3202126a69bc231a6b965bc1d73dee"); + + assertEquals(1, ver.major()); + assertEquals(2, ver.minor()); + assertEquals(3, ver.maintenance()); + assertEquals("rc1", ver.stage()); + assertEquals(4, ver.revisionTimestamp()); + assertArrayEquals(new byte[]{24, -27, -89, -20, -98, 50, 2, 18, 106, 105, -68, 35, 26, 107, -106, 91, -63, -41, 61, -18}, + ver.revisionHash()); + + IgniteProductVersion.fromString(VER + '-' + "ent" + '-' + BUILD_TSTAMP + '-' + REV_HASH); + + IgniteProductVersion.fromString(VER + '-' + "os" + '-' + BUILD_TSTAMP + '-' + REV_HASH); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerAbstractTest.java index dbb2d2d..0409da5 100644 --- a/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerAbstractTest.java @@ -31,7 +31,7 @@ import org.apache.ignite.internal.processors.streamer.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.marshaller.optimized.*; -import org.apache.ignite.product.*; +import org.apache.ignite.internal.product.*; import org.apache.ignite.streamer.*; import org.apache.ignite.streamer.window.*; import org.apache.ignite.internal.executor.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/test/java/org/apache/ignite/p2p/GridP2PClassLoadingSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/p2p/GridP2PClassLoadingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/p2p/GridP2PClassLoadingSelfTest.java index de08ae4..dca46fc 100644 --- a/modules/core/src/test/java/org/apache/ignite/p2p/GridP2PClassLoadingSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/p2p/GridP2PClassLoadingSelfTest.java @@ -20,7 +20,7 @@ package org.apache.ignite.p2p; import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.compute.*; -import org.apache.ignite.product.*; +import org.apache.ignite.lang.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.testframework.*; @@ -30,7 +30,7 @@ import org.jetbrains.annotations.*; import java.util.*; import java.util.concurrent.atomic.*; -import static org.apache.ignite.product.IgniteProductVersion.*; +import static org.apache.ignite.lang.IgniteProductVersion.*; /** * P2P test. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/test/java/org/apache/ignite/product/GridProductVersionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/product/GridProductVersionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/product/GridProductVersionSelfTest.java deleted file mode 100644 index b840d4f..0000000 --- a/modules/core/src/test/java/org/apache/ignite/product/GridProductVersionSelfTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.product; - -import org.apache.ignite.product.*; -import org.apache.ignite.testframework.junits.common.*; - -import static org.junit.Assert.*; -import static org.apache.ignite.internal.GridProductImpl.*; - -/** - * Versions test. - */ -public class GridProductVersionSelfTest extends GridCommonAbstractTest { - /** - * @throws Exception If failed. - */ - public void testFromString() throws Exception { - IgniteProductVersion ver = IgniteProductVersion.fromString("1.2.3"); - - assertEquals(1, ver.major()); - assertEquals(2, ver.minor()); - assertEquals(3, ver.maintenance()); - assertEquals("", ver.stage()); - assertEquals(0, ver.revisionTimestamp()); - assertArrayEquals(new byte[20], ver.revisionHash()); - - ver = IgniteProductVersion.fromString("1.2.3-ent-0-DEV"); - - assertEquals(1, ver.major()); - assertEquals(2, ver.minor()); - assertEquals(3, ver.maintenance()); - assertEquals(0, ver.revisionTimestamp()); - assertArrayEquals(new byte[20], ver.revisionHash()); - - ver = IgniteProductVersion.fromString("1.2.3-rc1-os-4-DEV"); - - assertEquals(1, ver.major()); - assertEquals(2, ver.minor()); - assertEquals(3, ver.maintenance()); - assertEquals("rc1", ver.stage()); - assertEquals(4, ver.revisionTimestamp()); - assertArrayEquals(new byte[20], ver.revisionHash()); - - ver = IgniteProductVersion.fromString("1.2.3-GA1-4-DEV"); - - assertEquals(1, ver.major()); - assertEquals(2, ver.minor()); - assertEquals(3, ver.maintenance()); - assertEquals("GA1", ver.stage()); - assertEquals(4, ver.revisionTimestamp()); - assertArrayEquals(new byte[20], ver.revisionHash()); - - ver = IgniteProductVersion.fromString("1.2.3-ent"); - - assertEquals(1, ver.major()); - assertEquals(2, ver.minor()); - assertEquals(3, ver.maintenance()); - assertEquals("", ver.stage()); - assertEquals(0, ver.revisionTimestamp()); - assertArrayEquals(new byte[20], ver.revisionHash()); - - ver = IgniteProductVersion.fromString("1.2.3-os-4"); - - assertEquals(1, ver.major()); - assertEquals(2, ver.minor()); - assertEquals(3, ver.maintenance()); - assertEquals("", ver.stage()); - assertEquals(4, ver.revisionTimestamp()); - assertArrayEquals(new byte[20], ver.revisionHash()); - - ver = IgniteProductVersion.fromString("1.2.3-ent-4-18e5a7ec9e3202126a69bc231a6b965bc1d73dee"); - - assertEquals(1, ver.major()); - assertEquals(2, ver.minor()); - assertEquals(3, ver.maintenance()); - assertEquals("", ver.stage()); - assertEquals(4, ver.revisionTimestamp()); - assertArrayEquals(new byte[]{24, -27, -89, -20, -98, 50, 2, 18, 106, 105, -68, 35, 26, 107, -106, 91, -63, -41, 61, -18}, - ver.revisionHash()); - - ver = IgniteProductVersion.fromString("1.2.3-rc1-os-4-18e5a7ec9e3202126a69bc231a6b965bc1d73dee"); - - assertEquals(1, ver.major()); - assertEquals(2, ver.minor()); - assertEquals(3, ver.maintenance()); - assertEquals("rc1", ver.stage()); - assertEquals(4, ver.revisionTimestamp()); - assertArrayEquals(new byte[]{24, -27, -89, -20, -98, 50, 2, 18, 106, 105, -68, 35, 26, 107, -106, 91, -63, -41, 61, -18}, - ver.revisionHash()); - - IgniteProductVersion.fromString(VER + '-' + "ent" + '-' + BUILD_TSTAMP + '-' + REV_HASH); - - IgniteProductVersion.fromString(VER + '-' + "os" + '-' + BUILD_TSTAMP + '-' + REV_HASH); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/test/java/org/apache/ignite/spi/discovery/GridAbstractDiscoverySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/GridAbstractDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/GridAbstractDiscoverySelfTest.java index 325c812..9e5cf4e 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/GridAbstractDiscoverySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/GridAbstractDiscoverySelfTest.java @@ -34,7 +34,7 @@ import java.util.*; import java.util.concurrent.atomic.*; import static org.apache.ignite.events.IgniteEventType.*; -import static org.apache.ignite.product.IgniteProductVersion.*; +import static org.apache.ignite.lang.IgniteProductVersion.*; /** * Base discovery self-test class. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/test/java/org/apache/ignite/testframework/GridTestNode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestNode.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestNode.java index 0067f04..e36cda3 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestNode.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestNode.java @@ -19,13 +19,13 @@ package org.apache.ignite.testframework; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.*; -import org.apache.ignite.product.*; +import org.apache.ignite.lang.*; import org.apache.ignite.internal.util.lang.*; import java.util.*; import java.util.concurrent.atomic.*; -import static org.apache.ignite.product.IgniteProductVersion.*; +import static org.apache.ignite.lang.IgniteProductVersion.*; /** * Test node. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridTestIgnite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridTestIgnite.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridTestIgnite.java index 8f36350..fe4d4ed 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridTestIgnite.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridTestIgnite.java @@ -17,7 +17,7 @@ import org.apache.ignite.hadoop.*; import org.apache.ignite.marshaller.IgniteMarshaller; import org.apache.ignite.plugin.*; import org.apache.ignite.plugin.security.*; -import org.apache.ignite.product.*; +import org.apache.ignite.internal.product.*; import org.jetbrains.annotations.*; import javax.management.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6df3ea93/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java index 2d5108f..1d1aa37 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java @@ -19,7 +19,7 @@ package org.apache.ignite.testframework.junits.spi; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.*; -import org.apache.ignite.product.*; +import org.apache.ignite.lang.*; import org.apache.ignite.spi.*; import org.apache.ignite.internal.managers.security.*; import org.apache.ignite.plugin.security.*; @@ -41,7 +41,7 @@ import java.lang.reflect.*; import java.util.*; import java.util.concurrent.*; -import static org.apache.ignite.product.IgniteProductVersion.*; +import static org.apache.ignite.lang.IgniteProductVersion.*; /** * Base SPI test class.