Repository: ignite Updated Branches: refs/heads/ignite-1282 7ad8e8080 -> 8045c820c
http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java ---------------------------------------------------------------------- diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java deleted file mode 100644 index 0e8b825..0000000 --- a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java +++ /dev/null @@ -1,119 +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.platform; - -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteException; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.compute.ComputeJob; -import org.apache.ignite.compute.ComputeJobAdapter; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.compute.ComputeTaskAdapter; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.portable.PortableMetadata; -import org.apache.ignite.portable.PortableObject; -import org.apache.ignite.resources.IgniteInstanceResource; -import org.jetbrains.annotations.Nullable; - -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -/** - * Task working with portable argument. - */ -public class PlatformComputePortableArgTask extends ComputeTaskAdapter<Object, Integer> { - /** {@inheritDoc} */ - @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, @Nullable Object arg) { - return Collections.singletonMap(new PortableArgJob(arg), F.first(subgrid)); - } - - /** {@inheritDoc} */ - @SuppressWarnings("ThrowableResultOfMethodCallIgnored") - @Nullable @Override public Integer reduce(List<ComputeJobResult> results) { - ComputeJobResult res = results.get(0); - - if (res.getException() != null) - throw res.getException(); - else - return results.get(0).getData(); - } - - /** - * Job. - */ - private static class PortableArgJob extends ComputeJobAdapter implements Externalizable { - /** */ - @IgniteInstanceResource - private Ignite ignite; - - /** Argument. */ - private Object arg; - - /** - * Constructor. - */ - public PortableArgJob() { - // No-op. - } - - /** - * Constructor. - * - * @param arg Argument. - */ - private PortableArgJob(Object arg) { - this.arg = arg; - } - - /** {@inheritDoc} */ - @Nullable @Override public Object execute() { - PortableObject arg0 = ((PortableObject)arg); - - PortableMetadata meta = ignite.portables().metadata(arg0.typeId()); - - if (meta == null) - throw new IgniteException("Metadata doesn't exist."); - - if (meta.fields() == null || !meta.fields().contains("Field")) - throw new IgniteException("Field metadata doesn't exist."); - - if (!F.eq("int", meta.fieldTypeName("Field"))) - throw new IgniteException("Invalid field type: " + meta.fieldTypeName("Field")); - - if (meta.affinityKeyFieldName() != null) - throw new IgniteException("Unexpected affinity key: " + meta.affinityKeyFieldName()); - - return arg0.field("field"); - } - - /** {@inheritDoc} */ - @Override public void writeExternal(ObjectOutput out) throws IOException { - out.writeObject(arg); - } - - /** {@inheritDoc} */ - @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - arg = in.readObject(); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/test/java/org/apache/ignite/platform/PlatformEventsWriteEventTask.java ---------------------------------------------------------------------- diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformEventsWriteEventTask.java b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformEventsWriteEventTask.java deleted file mode 100644 index d9dee9d..0000000 --- a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformEventsWriteEventTask.java +++ /dev/null @@ -1,146 +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.platform; - -import org.apache.ignite.Ignite; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.compute.ComputeJob; -import org.apache.ignite.compute.ComputeJobAdapter; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.compute.ComputeTaskAdapter; -import org.apache.ignite.events.CacheEvent; -import org.apache.ignite.events.CacheQueryExecutedEvent; -import org.apache.ignite.events.CacheQueryReadEvent; -import org.apache.ignite.events.CacheRebalancingEvent; -import org.apache.ignite.events.CheckpointEvent; -import org.apache.ignite.events.DiscoveryEvent; -import org.apache.ignite.events.JobEvent; -import org.apache.ignite.events.SwapSpaceEvent; -import org.apache.ignite.events.TaskEvent; -import org.apache.ignite.internal.portable.PortableRawWriterEx; -import org.apache.ignite.internal.processors.platform.PlatformContext; -import org.apache.ignite.internal.processors.platform.memory.PlatformMemory; -import org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream; -import org.apache.ignite.internal.processors.platform.utils.PlatformUtils; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.lang.IgniteUuid; -import org.apache.ignite.events.*; - -import org.apache.ignite.plugin.security.SecurityPermission; -import org.apache.ignite.plugin.security.SecuritySubjectType; -import org.apache.ignite.resources.IgniteInstanceResource; -import org.jetbrains.annotations.Nullable; - -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -/** - * Test task writing all events to a stream. - */ -@SuppressWarnings("UnusedDeclaration") -public class PlatformEventsWriteEventTask extends ComputeTaskAdapter<Long, Object> { - /** {@inheritDoc} */ - @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, - Long ptr) { - return Collections.singletonMap(new Job(ptr, F.first(subgrid)), F.first(subgrid)); - } - - /** {@inheritDoc} */ - @Nullable @Override public Object reduce(List<ComputeJobResult> results) { - return results.get(0).getData(); - } - - /** - * Job. - */ - @SuppressWarnings("deprecation") - private static class Job extends ComputeJobAdapter { - /** Grid. */ - @IgniteInstanceResource - protected transient Ignite ignite; - - /** Stream ptr. */ - private final long ptr; - - private final ClusterNode node; - - /** - * Constructor. - * - * @param ptr Stream ptr. - */ - public Job(long ptr, ClusterNode node) { - this.ptr = ptr; - this.node = node; - } - - /** {@inheritDoc} */ - @Nullable @Override public Object execute() { - PlatformContext ctx = PlatformUtils.platformContext(ignite); - - try (PlatformMemory mem = ctx.memory().get(ptr)) { - PlatformOutputStream out = mem.output(); - PortableRawWriterEx writer = ctx.writer(out); - - int evtType = EventType.EVT_SWAP_SPACE_CLEARED; - String msg = "msg"; - UUID uuid = new UUID(1, 2); - IgniteUuid igniteUuid = new IgniteUuid(uuid, 3); - - ctx.writeEvent(writer, new CacheEvent("cacheName", node, node, "msg", evtType, 1, true, 2, - igniteUuid, 3, 4, true, 5, true, uuid, "cloClsName", "taskName")); - - //noinspection unchecked - ctx.writeEvent(writer, new CacheQueryExecutedEvent(node, msg, evtType, "qryType", "cacheName", - "clsName", "clause", null, null, null, uuid, "taskName")); - - //noinspection unchecked - ctx.writeEvent(writer, new CacheQueryReadEvent(node, msg, evtType, "qryType", "cacheName", - "clsName", "clause", null, null, null, uuid, "taskName", 1, 2, 3, 4)); - - ctx.writeEvent(writer, new CacheRebalancingEvent("cacheName", node, msg, evtType, 1, node, 2, 3)); - - ctx.writeEvent(writer, new CheckpointEvent(node, msg, evtType, "cpKey")); - - DiscoveryEvent discoveryEvent = new DiscoveryEvent(node, msg, evtType, node); - discoveryEvent.topologySnapshot(ignite.cluster().topologyVersion(), ignite.cluster().nodes()); - ctx.writeEvent(writer, discoveryEvent); - - JobEvent jobEvent = new JobEvent(node, msg, evtType); - jobEvent.jobId(igniteUuid); - jobEvent.taskClassName("taskClsName"); - jobEvent.taskName("taskName"); - jobEvent.taskNode(node); - jobEvent.taskSessionId(igniteUuid); - jobEvent.taskSubjectId(uuid); - ctx.writeEvent(writer, jobEvent); - - ctx.writeEvent(writer, new SwapSpaceEvent(node, msg, evtType, "space")); - - ctx.writeEvent(writer, new TaskEvent(node, msg, evtType, igniteUuid, "taskName", "taskClsName", - true, uuid)); - - out.synchronize(); - } - - return true; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/test/java/org/apache/ignite/platform/PlatformMaxMemoryTask.java ---------------------------------------------------------------------- diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformMaxMemoryTask.java b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformMaxMemoryTask.java deleted file mode 100644 index 6effb0f..0000000 --- a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformMaxMemoryTask.java +++ /dev/null @@ -1,57 +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.platform; - -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.compute.ComputeJob; -import org.apache.ignite.compute.ComputeJobAdapter; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.compute.ComputeTaskAdapter; -import org.apache.ignite.internal.util.typedef.F; -import org.jetbrains.annotations.Nullable; - -import java.lang.management.ManagementFactory; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -/** - * Task to get max Java heap memory for node. - */ -public class PlatformMaxMemoryTask extends ComputeTaskAdapter<Object, Long> { - /** {@inheritDoc} */ - @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, - @Nullable Object arg) { - return Collections.singletonMap(new MaxMemoryJob(), F.first(subgrid)); - } - - /** {@inheritDoc} */ - @Nullable @Override public Long reduce(List<ComputeJobResult> results) { - return results.get(0).getData(); - } - - /** - * Job. - */ - private static class MaxMemoryJob extends ComputeJobAdapter { - /** {@inheritDoc} */ - @Nullable @Override public Object execute() { - return ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax(); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/test/java/org/apache/ignite/platform/PlatformMinMemoryTask.java ---------------------------------------------------------------------- diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformMinMemoryTask.java b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformMinMemoryTask.java deleted file mode 100644 index 23292f7..0000000 --- a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformMinMemoryTask.java +++ /dev/null @@ -1,57 +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.platform; - -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.compute.ComputeJob; -import org.apache.ignite.compute.ComputeJobAdapter; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.compute.ComputeTaskAdapter; -import org.apache.ignite.internal.util.typedef.F; -import org.jetbrains.annotations.Nullable; - -import java.lang.management.ManagementFactory; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -/** - * Task to get min Java heap memory for node. - */ -public class PlatformMinMemoryTask extends ComputeTaskAdapter<Object, Long> { - /** {@inheritDoc} */ - @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, - @Nullable Object arg) { - return Collections.singletonMap(new MinMemoryJob(), F.first(subgrid)); - } - - /** {@inheritDoc} */ - @Nullable @Override public Long reduce(List<ComputeJobResult> results) { - return results.get(0).getData(); - } - - /** - * Job. - */ - private static class MinMemoryJob extends ComputeJobAdapter { - /** {@inheritDoc} */ - @Nullable @Override public Object execute() { - return ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getInit(); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/test/java/org/apache/ignite/platform/lifecycle/PlatformJavaLifecycleBean.java ---------------------------------------------------------------------- diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/lifecycle/PlatformJavaLifecycleBean.java b/modules/platform/src/test/java/org/apache/ignite/platform/lifecycle/PlatformJavaLifecycleBean.java deleted file mode 100644 index d60912b..0000000 --- a/modules/platform/src/test/java/org/apache/ignite/platform/lifecycle/PlatformJavaLifecycleBean.java +++ /dev/null @@ -1,47 +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.platform.lifecycle; - -import org.apache.ignite.lifecycle.LifecycleBean; -import org.apache.ignite.lifecycle.LifecycleEventType; - -/** - * Java lifecycle bean. - */ -public class PlatformJavaLifecycleBean implements LifecycleBean { - /** Count of "beforeStart" invocations. */ - public static volatile int beforeStartCnt; - - /** Count of "afterStart" invocations. */ - public static volatile int afterStartCnt; - - /** {@inheritDoc} */ - @Override public void onLifecycleEvent(LifecycleEventType evt) { - switch (evt) { - case BEFORE_NODE_START: - beforeStartCnt++; - - break; - - case AFTER_NODE_START: - afterStartCnt++; - - break; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/test/java/org/apache/ignite/platform/lifecycle/PlatformJavaLifecycleTask.java ---------------------------------------------------------------------- diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/lifecycle/PlatformJavaLifecycleTask.java b/modules/platform/src/test/java/org/apache/ignite/platform/lifecycle/PlatformJavaLifecycleTask.java deleted file mode 100644 index ec01da1..0000000 --- a/modules/platform/src/test/java/org/apache/ignite/platform/lifecycle/PlatformJavaLifecycleTask.java +++ /dev/null @@ -1,65 +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.platform.lifecycle; - -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.compute.ComputeJob; -import org.apache.ignite.compute.ComputeJobAdapter; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.compute.ComputeTaskAdapter; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Lifecycle task. - */ -public class PlatformJavaLifecycleTask extends ComputeTaskAdapter<Object, List<Integer>> { - /** {@inheritDoc} */ - @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, - @Nullable Object arg) { - Map<ComputeJob, ClusterNode> jobs = new HashMap<>(); - - jobs.put(new LifecycleJob(), subgrid.get(0)); - - return jobs; - } - - /** {@inheritDoc} */ - @Nullable @Override public List<Integer> reduce(List<ComputeJobResult> results) { - return results.get(0).getData(); - } - - /** - * Job. - */ - private static class LifecycleJob extends ComputeJobAdapter { - /** {@inheritDoc} */ - @Nullable @Override public Object execute() { - List<Integer> res = new ArrayList<Integer>(); - - res.add(PlatformJavaLifecycleBean.beforeStartCnt); - res.add(PlatformJavaLifecycleBean.afterStartCnt); - - return res; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index b47958f..268221e 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,6 @@ <module>modules/yarn</module> <module>modules/jms11</module> <module>modules/zookeeper</module> - <module>modules/platform</module> </modules> <profiles> @@ -301,11 +300,6 @@ <chmod dir="${basedir}/target/release-package" perm="755" includes="**/*.sh" /> - <!-- hotfix according to https://issues.apache.org/jira/browse/IGNITE-1399. Remove at 1.5 --> - <move todir="${basedir}/target/temp/release-package/libs/optional/ignite-platform" failonerror="false"> - <fileset dir="${basedir}/target/release-package/libs/optional/ignite-platform"/> - </move> - <zip destfile="${basedir}/target/bin/${ignite.zip.pattern}.zip" encoding="UTF-8"> <zipfileset dir="${basedir}/target/release-package" prefix="${ignite.zip.pattern}" filemode="755"> <include name="**/*.sh" /> @@ -322,11 +316,6 @@ <exclude name="**/missing" /> </zipfileset> </zip> - - <!-- hotfix according to https://issues.apache.org/jira/browse/IGNITE-1399. Remove at 1.5 --> - <move todir="${basedir}/target/release-package/libs/optional/ignite-platform" failonerror="false"> - <fileset dir="${basedir}/target/temp/release-package/libs/optional/ignite-platform"/> - </move> </target> </configuration> </execution>