You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2018/01/04 05:56:13 UTC

[07/13] incubator-taverna-server git commit: package org.apache.taverna.server.usagerecord

package org.apache.taverna.server.usagerecord


Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/commit/bfbbe9f8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/tree/bfbbe9f8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/diff/bfbbe9f8

Branch: refs/heads/master
Commit: bfbbe9f8e65b24f471f9d8b1a9810b85cd01b1cf
Parents: a3e7d94
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Thu Jan 4 05:40:59 2018 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Thu Jan 4 05:40:59 2018 +0000

----------------------------------------------------------------------
 .../src/test/java/TestUR.java                   | 136 -------------------
 .../taverna/server/usagerecord/TestUR.java      | 136 +++++++++++++++++++
 2 files changed, 136 insertions(+), 136 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/bfbbe9f8/taverna-server-usagerecord/src/test/java/TestUR.java
----------------------------------------------------------------------
diff --git a/taverna-server-usagerecord/src/test/java/TestUR.java b/taverna-server-usagerecord/src/test/java/TestUR.java
deleted file mode 100644
index 9b5e70b..0000000
--- a/taverna-server-usagerecord/src/test/java/TestUR.java
+++ /dev/null
@@ -1,136 +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.
- */
-import static java.lang.Runtime.getRuntime;
-
-import java.io.IOException;
-import java.io.StringWriter;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.JAXBIntrospector;
-import javax.xml.bind.SchemaOutputResolver;
-import javax.xml.datatype.DatatypeConfigurationException;
-import javax.xml.transform.Result;
-import javax.xml.transform.stream.StreamResult;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.ogf.usage.JobUsageRecord;
-import org.ogf.usage.v1_0.Charge;
-import org.ogf.usage.v1_0.CpuDuration;
-import org.ogf.usage.v1_0.Disk;
-import org.ogf.usage.v1_0.EndTime;
-import org.ogf.usage.v1_0.Host;
-import org.ogf.usage.v1_0.JobIdentity;
-import org.ogf.usage.v1_0.JobName;
-import org.ogf.usage.v1_0.MachineName;
-import org.ogf.usage.v1_0.Memory;
-import org.ogf.usage.v1_0.Network;
-import org.ogf.usage.v1_0.NodeCount;
-import org.ogf.usage.v1_0.PhaseResource;
-import org.ogf.usage.v1_0.Processors;
-import org.ogf.usage.v1_0.ProjectName;
-import org.ogf.usage.v1_0.Queue;
-import org.ogf.usage.v1_0.RecordIdentity;
-import org.ogf.usage.v1_0.ServiceLevel;
-import org.ogf.usage.v1_0.StartTime;
-import org.ogf.usage.v1_0.Status;
-import org.ogf.usage.v1_0.SubmitHost;
-import org.ogf.usage.v1_0.Swap;
-import org.ogf.usage.v1_0.TimeDuration;
-import org.ogf.usage.v1_0.TimeInstant;
-import org.ogf.usage.v1_0.UserIdentity;
-import org.ogf.usage.v1_0.VolumeResource;
-import org.ogf.usage.v1_0.WallDuration;
-
-public class TestUR {
-	SchemaOutputResolver sink;
-	StringWriter writer;
-
-	String result() {
-		return writer.toString();
-	}
-
-	@Before
-	public void setUp() throws Exception {
-		writer = new StringWriter();
-		sink = new SchemaOutputResolver() {
-			@Override
-			public Result createOutput(String namespaceUri,
-					String suggestedFileName) throws IOException {
-				StreamResult sr = new StreamResult(writer);
-				sr.setSystemId("/dev/null");
-				return sr;
-			}
-		};
-		Assert.assertNull(null);// Shut up, Eclipse!
-		Assert.assertEquals("", result());
-	}
-
-	@Test
-	public void testSchema() throws JAXBException, IOException {
-		JAXBContext.newInstance(JobUsageRecord.class).generateSchema(sink);
-		Assert.assertNotSame("", result());
-	}
-
-	@Test
-	public void testSchemaCompleteness() throws JAXBException, DatatypeConfigurationException {
-		JAXBIntrospector info = JAXBContext.newInstance(JobUsageRecord.class).createJAXBIntrospector();
-		Assert.assertTrue(info.isElement(new Charge()));
-		Assert.assertTrue(info.isElement(new CpuDuration()));
-		Assert.assertTrue(info.isElement(new Disk()));
-		Assert.assertTrue(info.isElement(new EndTime()));
-		Assert.assertTrue(info.isElement(new Host()));
-		Assert.assertTrue(info.isElement(new JobIdentity()));
-		Assert.assertTrue(info.isElement(new JobName()));
-		Assert.assertTrue(info.isElement(new JobUsageRecord()));
-		Assert.assertTrue(info.isElement(new MachineName()));
-		Assert.assertTrue(info.isElement(new Memory()));
-		Assert.assertTrue(info.isElement(new Network()));
-		Assert.assertTrue(info.isElement(new NodeCount()));
-		Assert.assertTrue(info.isElement(new PhaseResource()));
-		Assert.assertTrue(info.isElement(new Processors()));
-		Assert.assertTrue(info.isElement(new ProjectName()));
-		Assert.assertTrue(info.isElement(new Queue()));
-		Assert.assertTrue(info.isElement(new RecordIdentity()));
-		Assert.assertTrue(info.isElement(new ServiceLevel()));
-		Assert.assertTrue(info.isElement(new StartTime()));
-		Assert.assertTrue(info.isElement(new Status()));
-		Assert.assertTrue(info.isElement(new SubmitHost()));
-		Assert.assertTrue(info.isElement(new Swap()));
-		Assert.assertTrue(info.isElement(new TimeDuration()));
-		Assert.assertTrue(info.isElement(new TimeInstant()));
-		Assert.assertTrue(info.isElement(new UserIdentity()));
-		Assert.assertTrue(info.isElement(new VolumeResource()));
-		Assert.assertTrue(info.isElement(new WallDuration()));
-	}
-
-	@Test
-	public void testGenerate() throws DatatypeConfigurationException,
-			JAXBException {
-		JobUsageRecord ur = new JobUsageRecord();
-		ur.setStatus("Completed");
-		ur.addWallDuration(1000 * 65);
-		ur.addHost("localhost");
-		ur.addMemory(getRuntime().totalMemory() - getRuntime().freeMemory()).setType("vm");
-
-		String record = ur.marshal();
-		Assert.assertNotSame("", record);
-		//System.out.println(record);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/bfbbe9f8/taverna-server-usagerecord/src/test/java/org/apache/taverna/server/usagerecord/TestUR.java
----------------------------------------------------------------------
diff --git a/taverna-server-usagerecord/src/test/java/org/apache/taverna/server/usagerecord/TestUR.java b/taverna-server-usagerecord/src/test/java/org/apache/taverna/server/usagerecord/TestUR.java
new file mode 100644
index 0000000..9b5e70b
--- /dev/null
+++ b/taverna-server-usagerecord/src/test/java/org/apache/taverna/server/usagerecord/TestUR.java
@@ -0,0 +1,136 @@
+/*
+ * 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.
+ */
+import static java.lang.Runtime.getRuntime;
+
+import java.io.IOException;
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.JAXBIntrospector;
+import javax.xml.bind.SchemaOutputResolver;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.transform.Result;
+import javax.xml.transform.stream.StreamResult;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.ogf.usage.JobUsageRecord;
+import org.ogf.usage.v1_0.Charge;
+import org.ogf.usage.v1_0.CpuDuration;
+import org.ogf.usage.v1_0.Disk;
+import org.ogf.usage.v1_0.EndTime;
+import org.ogf.usage.v1_0.Host;
+import org.ogf.usage.v1_0.JobIdentity;
+import org.ogf.usage.v1_0.JobName;
+import org.ogf.usage.v1_0.MachineName;
+import org.ogf.usage.v1_0.Memory;
+import org.ogf.usage.v1_0.Network;
+import org.ogf.usage.v1_0.NodeCount;
+import org.ogf.usage.v1_0.PhaseResource;
+import org.ogf.usage.v1_0.Processors;
+import org.ogf.usage.v1_0.ProjectName;
+import org.ogf.usage.v1_0.Queue;
+import org.ogf.usage.v1_0.RecordIdentity;
+import org.ogf.usage.v1_0.ServiceLevel;
+import org.ogf.usage.v1_0.StartTime;
+import org.ogf.usage.v1_0.Status;
+import org.ogf.usage.v1_0.SubmitHost;
+import org.ogf.usage.v1_0.Swap;
+import org.ogf.usage.v1_0.TimeDuration;
+import org.ogf.usage.v1_0.TimeInstant;
+import org.ogf.usage.v1_0.UserIdentity;
+import org.ogf.usage.v1_0.VolumeResource;
+import org.ogf.usage.v1_0.WallDuration;
+
+public class TestUR {
+	SchemaOutputResolver sink;
+	StringWriter writer;
+
+	String result() {
+		return writer.toString();
+	}
+
+	@Before
+	public void setUp() throws Exception {
+		writer = new StringWriter();
+		sink = new SchemaOutputResolver() {
+			@Override
+			public Result createOutput(String namespaceUri,
+					String suggestedFileName) throws IOException {
+				StreamResult sr = new StreamResult(writer);
+				sr.setSystemId("/dev/null");
+				return sr;
+			}
+		};
+		Assert.assertNull(null);// Shut up, Eclipse!
+		Assert.assertEquals("", result());
+	}
+
+	@Test
+	public void testSchema() throws JAXBException, IOException {
+		JAXBContext.newInstance(JobUsageRecord.class).generateSchema(sink);
+		Assert.assertNotSame("", result());
+	}
+
+	@Test
+	public void testSchemaCompleteness() throws JAXBException, DatatypeConfigurationException {
+		JAXBIntrospector info = JAXBContext.newInstance(JobUsageRecord.class).createJAXBIntrospector();
+		Assert.assertTrue(info.isElement(new Charge()));
+		Assert.assertTrue(info.isElement(new CpuDuration()));
+		Assert.assertTrue(info.isElement(new Disk()));
+		Assert.assertTrue(info.isElement(new EndTime()));
+		Assert.assertTrue(info.isElement(new Host()));
+		Assert.assertTrue(info.isElement(new JobIdentity()));
+		Assert.assertTrue(info.isElement(new JobName()));
+		Assert.assertTrue(info.isElement(new JobUsageRecord()));
+		Assert.assertTrue(info.isElement(new MachineName()));
+		Assert.assertTrue(info.isElement(new Memory()));
+		Assert.assertTrue(info.isElement(new Network()));
+		Assert.assertTrue(info.isElement(new NodeCount()));
+		Assert.assertTrue(info.isElement(new PhaseResource()));
+		Assert.assertTrue(info.isElement(new Processors()));
+		Assert.assertTrue(info.isElement(new ProjectName()));
+		Assert.assertTrue(info.isElement(new Queue()));
+		Assert.assertTrue(info.isElement(new RecordIdentity()));
+		Assert.assertTrue(info.isElement(new ServiceLevel()));
+		Assert.assertTrue(info.isElement(new StartTime()));
+		Assert.assertTrue(info.isElement(new Status()));
+		Assert.assertTrue(info.isElement(new SubmitHost()));
+		Assert.assertTrue(info.isElement(new Swap()));
+		Assert.assertTrue(info.isElement(new TimeDuration()));
+		Assert.assertTrue(info.isElement(new TimeInstant()));
+		Assert.assertTrue(info.isElement(new UserIdentity()));
+		Assert.assertTrue(info.isElement(new VolumeResource()));
+		Assert.assertTrue(info.isElement(new WallDuration()));
+	}
+
+	@Test
+	public void testGenerate() throws DatatypeConfigurationException,
+			JAXBException {
+		JobUsageRecord ur = new JobUsageRecord();
+		ur.setStatus("Completed");
+		ur.addWallDuration(1000 * 65);
+		ur.addHost("localhost");
+		ur.addMemory(getRuntime().totalMemory() - getRuntime().freeMemory()).setType("vm");
+
+		String record = ur.marshal();
+		Assert.assertNotSame("", record);
+		//System.out.println(record);
+	}
+}