Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
385adc5f
Commit
385adc5f
authored
Jan 06, 2015
by
Harish Butani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tests to use a dateformat w/o timeZone
parent
3291e928
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
12 deletions
+25
-12
MemRepository.java
.../apache/hadoop/metadata/storage/memory/MemRepository.java
+2
-2
DataTypes.java
...main/java/org/apache/hadoop/metadata/types/DataTypes.java
+6
-0
package.scala
...c/main/scala/org/apache/hadoop/metadata/dsl/package.scala
+8
-1
EnumTest.java
...em/src/test/java/org/apache/hadoop/metadata/EnumTest.java
+4
-4
StructTest.java
.../src/test/java/org/apache/hadoop/metadata/StructTest.java
+1
-1
DSLTest.scala
...c/test/scala/org/apache/hadoop/metadata/dsl/DSLTest.scala
+1
-1
SerializationTest.scala
...a/org/apache/hadoop/metadata/json/SerializationTest.scala
+3
-3
No files found.
typesystem/src/main/java/org/apache/hadoop/metadata/storage/memory/MemRepository.java
View file @
385adc5f
...
@@ -31,8 +31,8 @@ import java.util.concurrent.atomic.AtomicInteger;
...
@@ -31,8 +31,8 @@ import java.util.concurrent.atomic.AtomicInteger;
public
class
MemRepository
implements
IRepository
{
public
class
MemRepository
implements
IRepository
{
p
rivate
static
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
p
ublic
static
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
p
rivate
static
SimpleDateFormat
timestampFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss
"
);
p
ublic
static
SimpleDateFormat
timestampFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd
"
);
final
TypeSystem
typeSystem
;
final
TypeSystem
typeSystem
;
/*
/*
...
...
typesystem/src/main/java/org/apache/hadoop/metadata/types/DataTypes.java
View file @
385adc5f
...
@@ -401,6 +401,12 @@ public class DataTypes {
...
@@ -401,6 +401,12 @@ public class DataTypes {
return
convertNull
(
m
);
return
convertNull
(
m
);
}
}
@Override
public
void
output
(
Date
val
,
Appendable
buf
,
String
prefix
)
throws
MetadataException
{
TypeUtils
.
outputVal
(
val
==
null
?
"<null>"
:
MetadataService
.
getCurrentRepository
().
getDateFormat
().
format
(
val
),
buf
,
prefix
);
}
public
Date
nullValue
()
{
public
Date
nullValue
()
{
return
null
;
return
null
;
}
}
...
...
typesystem/src/main/scala/org/apache/hadoop/metadata/dsl/package.scala
View file @
385adc5f
...
@@ -18,6 +18,8 @@
...
@@ -18,6 +18,8 @@
package
org.apache.hadoop.metadata
package
org.apache.hadoop.metadata
import
java.text.SimpleDateFormat
import
org.apache.hadoop.metadata.json.
{
BigIntegerSerializer
,
BigDecimalSerializer
,
TypedStructSerializer
,
Serialization
}
import
org.apache.hadoop.metadata.json.
{
BigIntegerSerializer
,
BigDecimalSerializer
,
TypedStructSerializer
,
Serialization
}
import
org.apache.hadoop.metadata.storage.StructInstance
import
org.apache.hadoop.metadata.storage.StructInstance
import
org.apache.hadoop.metadata.types._
import
org.apache.hadoop.metadata.types._
...
@@ -31,7 +33,12 @@ import scala.language.implicitConversions
...
@@ -31,7 +33,12 @@ import scala.language.implicitConversions
package
object
dsl
{
package
object
dsl
{
implicit
val
formats
=
org
.
json4s
.
native
.
Serialization
.
formats
(
NoTypeHints
)
+
new
TypedStructSerializer
+
val
defFormat
=
new
DefaultFormats
{
override
protected
def
dateFormatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
)
override
val
typeHints
=
NoTypeHints
}
implicit
val
formats
=
defFormat
+
new
TypedStructSerializer
+
new
BigDecimalSerializer
+
new
BigIntegerSerializer
new
BigDecimalSerializer
+
new
BigIntegerSerializer
def
service
=
MetadataService
.
getCurrentService
def
service
=
MetadataService
.
getCurrentService
...
...
typesystem/src/test/java/org/apache/hadoop/metadata/EnumTest.java
View file @
385adc5f
...
@@ -150,7 +150,7 @@ public class EnumTest extends BaseTest {
...
@@ -150,7 +150,7 @@ public class EnumTest extends BaseTest {
"\tj : \t1\n"
+
"\tj : \t1\n"
+
"\tk : \t1\n"
+
"\tk : \t1\n"
+
"\tenum3 : \tCOMMITTED\n"
+
"\tenum3 : \tCOMMITTED\n"
+
"\tl : \t
Wed Dec 10 18:35:58 PST 2014
\n"
+
"\tl : \t
2014-12-10
\n"
+
"\tm : \t[1, 1]\n"
+
"\tm : \t[1, 1]\n"
+
"\tn : \t[1.1, 1.1]\n"
+
"\tn : \t[1.1, 1.1]\n"
+
"\to : \t{b=2.0, a=1.0}\n"
+
"\to : \t{b=2.0, a=1.0}\n"
+
...
@@ -182,7 +182,7 @@ public class EnumTest extends BaseTest {
...
@@ -182,7 +182,7 @@ public class EnumTest extends BaseTest {
"\tj : \t1\n"
+
"\tj : \t1\n"
+
"\tk : \t1\n"
+
"\tk : \t1\n"
+
"\tenum3 : \tCOMMITTED\n"
+
"\tenum3 : \tCOMMITTED\n"
+
"\tl : \t
Wed Dec 10 18:35:58 PST 2014
\n"
+
"\tl : \t
2014-12-10
\n"
+
"\tm : \t[1, 1]\n"
+
"\tm : \t[1, 1]\n"
+
"\tn : \t[1.1, 1.1]\n"
+
"\tn : \t[1.1, 1.1]\n"
+
"\to : \t{b=2.0, a=1.0}\n"
+
"\to : \t{b=2.0, a=1.0}\n"
+
...
@@ -219,7 +219,7 @@ public class EnumTest extends BaseTest {
...
@@ -219,7 +219,7 @@ public class EnumTest extends BaseTest {
"\tj : \t1\n"
+
"\tj : \t1\n"
+
"\tk : \t1\n"
+
"\tk : \t1\n"
+
"\tenum3 : \tCOMMITTED\n"
+
"\tenum3 : \tCOMMITTED\n"
+
"\tl : \t
Wed Dec 10 18:35:58 PST 2014
\n"
+
"\tl : \t
2014-12-10
\n"
+
"\tm : \t[1, 1]\n"
+
"\tm : \t[1, 1]\n"
+
"\tn : \t[1.1, 1.1]\n"
+
"\tn : \t[1.1, 1.1]\n"
+
"\to : \t{b=2.0, a=1.0}\n"
+
"\to : \t{b=2.0, a=1.0}\n"
+
...
@@ -259,7 +259,7 @@ public class EnumTest extends BaseTest {
...
@@ -259,7 +259,7 @@ public class EnumTest extends BaseTest {
"\tj : \t1\n"
+
"\tj : \t1\n"
+
"\tk : \t1\n"
+
"\tk : \t1\n"
+
"\tenum3 : \tCOMMITTED\n"
+
"\tenum3 : \tCOMMITTED\n"
+
"\tl : \t
Thu Dec 11 00:00:00 PST 2014
\n"
+
"\tl : \t
2014-12-11
\n"
+
"\tm : \t[1, 1]\n"
+
"\tm : \t[1, 1]\n"
+
"\tn : \t[1.100000000000000088817841970012523233890533447265625, 1"
+
"\tn : \t[1.100000000000000088817841970012523233890533447265625, 1"
+
".100000000000000088817841970012523233890533447265625]\n"
+
".100000000000000088817841970012523233890533447265625]\n"
+
...
...
typesystem/src/test/java/org/apache/hadoop/metadata/StructTest.java
View file @
385adc5f
...
@@ -52,7 +52,7 @@ public class StructTest extends BaseTest {
...
@@ -52,7 +52,7 @@ public class StructTest extends BaseTest {
"\ti : \t1.0\n"
+
"\ti : \t1.0\n"
+
"\tj : \t1\n"
+
"\tj : \t1\n"
+
"\tk : \t1\n"
+
"\tk : \t1\n"
+
"\tl : \t
Wed Dec 10 18:35:58 PST 2014
\n"
+
"\tl : \t
2014-12-10
\n"
+
"\tm : \t[1, 1]\n"
+
"\tm : \t[1, 1]\n"
+
"\tn : \t[1.1, 1.1]\n"
+
"\tn : \t[1.1, 1.1]\n"
+
"\to : \t{b=2.0, a=1.0}\n"
+
"\to : \t{b=2.0, a=1.0}\n"
+
...
...
typesystem/src/test/scala/org/apache/hadoop/metadata/dsl/DSLTest.scala
View file @
385adc5f
...
@@ -94,7 +94,7 @@ class DSLTest extends BaseTest {
...
@@ -94,7 +94,7 @@ class DSLTest extends BaseTest {
Assert
.
assertEquals
(
s
"${i.o.asInstanceOf[java.util.Map[_,_]].keySet}"
,
"[b, a]"
)
Assert
.
assertEquals
(
s
"${i.o.asInstanceOf[java.util.Map[_,_]].keySet}"
,
"[b, a]"
)
// 5. Serialize mytype instance to Json
// 5. Serialize mytype instance to Json
Assert
.
assertEquals
(
s
"${pretty(render(i))}"
,
"{\n \"$typeName$\":\"mytype\",\n \"e\":1,\n \"n\":[1,1.100000000000000088817841970012523233890533447265625],\n \"h\":1.0,\n \"b\":true,\n \"k\":1,\n \"j\":1,\n \"d\":2,\n \"m\":[1,1],\n \"g\":1,\n \"a\":1,\n \"i\":1.0,\n \"c\":1,\n \"l\":\"2014-12-03
T08:00:00.000Z
\",\n \"f\":1,\n \"o\":{\n \"b\":2.0,\n \"a\":1.0\n }\n}"
)
Assert
.
assertEquals
(
s
"${pretty(render(i))}"
,
"{\n \"$typeName$\":\"mytype\",\n \"e\":1,\n \"n\":[1,1.100000000000000088817841970012523233890533447265625],\n \"h\":1.0,\n \"b\":true,\n \"k\":1,\n \"j\":1,\n \"d\":2,\n \"m\":[1,1],\n \"g\":1,\n \"a\":1,\n \"i\":1.0,\n \"c\":1,\n \"l\":\"2014-12-03\",\n \"f\":1,\n \"o\":{\n \"b\":2.0,\n \"a\":1.0\n }\n}"
)
}
}
@Test
def
test2
{
@Test
def
test2
{
...
...
typesystem/src/test/scala/org/apache/hadoop/metadata/json/SerializationTest.scala
View file @
385adc5f
...
@@ -48,7 +48,7 @@ class SerializationTest extends BaseTest {
...
@@ -48,7 +48,7 @@ class SerializationTest extends BaseTest {
val
s
:
Struct
=
BaseTest
.
createStruct
(
ms
)
val
s
:
Struct
=
BaseTest
.
createStruct
(
ms
)
val
ts
:
ITypedStruct
=
structType
.
convert
(
s
,
Multiplicity
.
REQUIRED
)
val
ts
:
ITypedStruct
=
structType
.
convert
(
s
,
Multiplicity
.
REQUIRED
)
Assert
.
assertEquals
(
ts
.
toString
,
"{\n\ta : \t1\n\tb : \ttrue\n\tc : \t1\n\td : \t2\n\te : \t1\n\tf : \t1\n\tg : \t1\n\th : \t1.0\n\ti : \t1.0\n\tj : \t1\n\tk : \t1\n\tl : \t
Wed Dec 10 18:35:58 PST 2014
\n\tm : \t[1, 1]\n\tn : \t[1.1, 1.1]\n\to : \t{b=2.0, a=1.0}\n}"
)
Assert
.
assertEquals
(
ts
.
toString
,
"{\n\ta : \t1\n\tb : \ttrue\n\tc : \t1\n\td : \t2\n\te : \t1\n\tf : \t1\n\tg : \t1\n\th : \t1.0\n\ti : \t1.0\n\tj : \t1\n\tk : \t1\n\tl : \t
2014-12-10
\n\tm : \t[1, 1]\n\tn : \t[1.1, 1.1]\n\to : \t{b=2.0, a=1.0}\n}"
)
implicit
val
formats
=
org
.
json4s
.
native
.
Serialization
.
formats
(
NoTypeHints
)
+
new
TypedStructSerializer
+
implicit
val
formats
=
org
.
json4s
.
native
.
Serialization
.
formats
(
NoTypeHints
)
+
new
TypedStructSerializer
+
new
BigDecimalSerializer
+
new
BigIntegerSerializer
new
BigDecimalSerializer
+
new
BigIntegerSerializer
...
@@ -59,7 +59,7 @@ class SerializationTest extends BaseTest {
...
@@ -59,7 +59,7 @@ class SerializationTest extends BaseTest {
// Typed Struct read back
// Typed Struct read back
val
ts1
=
read
[
StructInstance
](
ser
)
val
ts1
=
read
[
StructInstance
](
ser
)
Assert
.
assertEquals
(
ts1
.
toString
,
"{\n\ta : \t1\n\tb : \ttrue\n\tc : \t1\n\td : \t2\n\te : \t1\n\tf : \t1\n\tg : \t1\n\th : \t1.0\n\ti : \t1.0\n\tj : \t1\n\tk : \t1\n\tl : \t
Thu Dec 11 00:00:00 PST 2014
\n\tm : \t[1, 1]\n\tn : \t[1.100000000000000088817841970012523233890533447265625, 1.100000000000000088817841970012523233890533447265625]\n\to : \t{b=2.0, a=1.0}\n}"
)
Assert
.
assertEquals
(
ts1
.
toString
,
"{\n\ta : \t1\n\tb : \ttrue\n\tc : \t1\n\td : \t2\n\te : \t1\n\tf : \t1\n\tg : \t1\n\th : \t1.0\n\ti : \t1.0\n\tj : \t1\n\tk : \t1\n\tl : \t
2014-12-11
\n\tm : \t[1, 1]\n\tn : \t[1.100000000000000088817841970012523233890533447265625, 1.100000000000000088817841970012523233890533447265625]\n\to : \t{b=2.0, a=1.0}\n}"
)
}
}
@Test
def
test2
{
@Test
def
test2
{
...
@@ -74,7 +74,7 @@ class SerializationTest extends BaseTest {
...
@@ -74,7 +74,7 @@ class SerializationTest extends BaseTest {
{"$typeName$":"t1","e":1,"n":[1.1,1.1],"h":1.0,"b":true,"k":1,"j":1,"d":2,"m":[1,1],"g":1,"a":1,"i":1.0,
{"$typeName$":"t1","e":1,"n":[1.1,1.1],"h":1.0,"b":true,"k":1,"j":1,"d":2,"m":[1,1],"g":1,"a":1,"i":1.0,
"c":1,"l":"2014-12-03T19:38:55.053Z","f":1,"o":{"b":2.0,"a":1.0}}"""
)
"c":1,"l":"2014-12-03T19:38:55.053Z","f":1,"o":{"b":2.0,"a":1.0}}"""
)
// Typed Struct read from string
// Typed Struct read from string
Assert
.
assertEquals
(
ts1
.
toString
,
"{\n\ta : \t1\n\tb : \ttrue\n\tc : \t1\n\td : \t2\n\te : \t1\n\tf : \t1\n\tg : \t1\n\th : \t1.0\n\ti : \t1.0\n\tj : \t1\n\tk : \t1\n\tl : \t
Wed Dec 03 00:00:00 PST 2014
\n\tm : \t[1, 1]\n\tn : \t[1.100000000000000088817841970012523233890533447265625, 1.100000000000000088817841970012523233890533447265625]\n\to : \t{b=2.0, a=1.0}\n}"
)
Assert
.
assertEquals
(
ts1
.
toString
,
"{\n\ta : \t1\n\tb : \ttrue\n\tc : \t1\n\td : \t2\n\te : \t1\n\tf : \t1\n\tg : \t1\n\th : \t1.0\n\ti : \t1.0\n\tj : \t1\n\tk : \t1\n\tl : \t
2014-12-03
\n\tm : \t[1, 1]\n\tn : \t[1.100000000000000088817841970012523233890533447265625, 1.100000000000000088817841970012523233890533447265625]\n\to : \t{b=2.0, a=1.0}\n}"
)
}
}
@Test
def
testTrait
{
@Test
def
testTrait
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment