-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPalletSamples.py
86 lines (59 loc) · 2.68 KB
/
PalletSamples.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env python
# * coding: utf8 *
"""
PalletSamples.py
A module that contains a sample Pallets to test forklift. These can be thought of as acceptance tests.
We should be able to run them twice without errors. Once to create, and once to check for updates.
"""
from os import path
from forklift.models import Pallet
data_folder = path.join(path.dirname(path.realpath(__file__)), "data")
destination_workspace = path.join(data_folder, "SampleDestination.gdb")
class StringCratePallet(Pallet):
def __init__(self):
#: this is required to initialize the Pallet base class properties
super().__init__()
self.copy_data = [destination_workspace]
def build(self, configuration):
source_workspace = path.join(data_folder, "[email protected]")
self.add_crate(
"Counties", {"source_workspace": source_workspace, "destination_workspace": destination_workspace}
)
class ExplicitCratePallet(Pallet):
def __init__(self):
#: this is required to initialize the Pallet base class properties
super().__init__()
self.copy_data = [destination_workspace]
def build(self, configuration):
source_workspace = path.join(data_folder, "[email protected]")
crate_info = ("AvalanchePaths", source_workspace, destination_workspace, "AvyPaths")
self.add_crate(crate_info)
class OneValueTupleCratePallet(Pallet):
def __init__(self):
#: this is required to initialize the Pallet base class properties
super().__init__()
def build(self, configuration):
source_workspace = path.join(data_folder, "[email protected]")
crate_info = "AvalanchePaths"
self.add_crate(
crate_info, {"source_workspace": source_workspace, "destination_workspace": destination_workspace}
)
class ShapefileCratePallet(Pallet):
def __init__(self):
#: this is required to initialize the Pallet base class properties
super().__init__()
self.copy_data = [destination_workspace]
def build(self, configuration):
source_workspace = path.join(data_folder, "myshape.shp")
self.add_crate(
"myshape", {"source_workspace": source_workspace, "destination_workspace": destination_workspace}
)
def ship(self):
self.send_email("[email protected]", "test email", "hello")
class SdeCratePallet(Pallet):
def build(self, configuration):
destination_workspace = path.join(data_folder, "UPDATE_TESTS.sde")
source_workspace = path.join(data_folder, "[email protected]")
self.add_crate(
"Counties", {"source_workspace": source_workspace, "destination_workspace": destination_workspace}
)