Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
OpsPortal
lavoisiercli
Commits
da78a05f
Commit
da78a05f
authored
Oct 14, 2014
by
Olivier Lequeux
Browse files
add xsd options to entries class
parent
b49bdf77
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
37 additions
and
13 deletions
+37
-13
resources/ex_entries.xsd
resources/ex_entries.xsd
+2
-2
src/Lavoisier/Entries/Entries.php
src/Lavoisier/Entries/Entries.php
+29
-3
src/Lavoisier/Hydrators/StringHydrator.php
src/Lavoisier/Hydrators/StringHydrator.php
+0
-2
tests/EntriesTest.php
tests/EntriesTest.php
+1
-1
tests/Resources/entries.xml
tests/Resources/entries.xml
+1
-1
tests/Resources/entries_collection.xml
tests/Resources/entries_collection.xml
+1
-1
tests/Resources/entries_test.xml
tests/Resources/entries_test.xml
+1
-1
tests/Resources/site_names.xml
tests/Resources/site_names.xml
+1
-1
tests/Resources/tickets.xml
tests/Resources/tickets.xml
+1
-1
No files found.
resources/ex_entries.xsd
View file @
da78a05f
<?xml version="1.0" encoding="UTF-8"?>
<schema
xmlns=
"http://www.w3.org/2001/XMLSchema"
xmlns:tns=
"https://gitlab.in2p3.fr/opsportal/lavoisier
query
/raw/master/ex_entries.xsd"
targetNamespace=
"https://gitlab.in2p3.fr/opsportal/lavoisier
query
/raw/master/ex_entries.xsd"
xmlns:tns=
"https://gitlab.in2p3.fr/opsportal/lavoisier
cli
/raw/master/
resources/
ex_entries.xsd"
targetNamespace=
"https://gitlab.in2p3.fr/opsportal/lavoisier
cli
/raw/master/
resources/
ex_entries.xsd"
attributeFormDefault=
"unqualified"
elementFormDefault=
"qualified"
>
<!--
@author : Olivier Lequeux
...
...
src/Lavoisier/Entries/Entries.php
View file @
da78a05f
...
...
@@ -8,10 +8,34 @@ namespace Lavoisier\Entries;
* Date: 28/10/13
*/
const
$EX_ENTRIES_XMLNS
=
""
class
Entries
extends
\
ArrayObject
implements
IEntries
{
// original simple entries/entry Lavoisier xsd (it's a subset of the following one)
const
XMLNS_entries
=
"http://software.in2p3.fr/lavoisier/entries.xsd"
;
// extended recursive entries/entries/.../entries/entry lavoisiercli xsd
const
XMLNS_ex_entries
=
"https://gitlab.in2p3.fr/opsportal/lavoisiercli/raw/master/resources/ex_entries.xsd"
;
/*
* @param bool set true to ask original Lavoisier XMLNS
* @return string XMLNS
*/
static
public
function
getXMLNS
(
$useLavoisierXMLNS
=
true
)
{
if
(
true
===
$useLavoisierXMLNS
)
{
return
self
::
XMLNS_entries
;
}
else
{
return
self
::
XMLNS_ex_entries
;
}
}
public
function
__construct
()
{
$this
->
useLavoisierXMLNS
=
true
;
}
public
function
init
()
{
}
...
...
@@ -24,6 +48,7 @@ class Entries extends \ArrayObject implements IEntries
if
(
$iterator
->
valid
())
{
$item
=
$iterator
->
current
();
}
return
$item
;
}
...
...
@@ -52,9 +77,9 @@ class Entries extends \ArrayObject implements IEntries
return
self
::
convertToEntries
(
$this
);
}
static
protected
function
convertToEntries
(
$data
)
static
protected
function
convertToEntries
(
$data
,
$useLavoisierXMLNS
=
true
)
{
$xml
=
'<e:entries xmlns:e="
http://software.in2p3.fr/lavoisier/entries.xsd">'
;
$xml
=
sprintf
(
'<e:entries xmlns:e="
%s">'
,
self
::
getXMLNS
(
$useLavoisierXMLNS
))
;
foreach
(
$data
as
$key
=>
$entry
)
{
if
(
is_array
(
$entry
))
{
$xml
.
=
self
::
convertToEntries
(
$entry
);
...
...
@@ -62,6 +87,7 @@ class Entries extends \ArrayObject implements IEntries
$xml
.
=
'<e:entry key ="'
.
$key
.
'">'
.
$entry
.
'</e:entry>'
;
}
}
return
$xml
.
'</e:entries>'
;
}
...
...
src/Lavoisier/Hydrators/StringHydrator.php
View file @
da78a05f
...
...
@@ -2,8 +2,6 @@
namespace
Lavoisier\Hydrators
;
use
\
Lavoisier\IHydrator
;
class
StringHydrator
implements
IHydrator
{
public
function
hydrate
(
$str
)
{
...
...
tests/EntriesTest.php
View file @
da78a05f
...
...
@@ -40,7 +40,7 @@ class EntriesTest extends \PHPUnit_Framework_TestCase
$hydrator
=
new
\
Lavoisier\Hydrators\EntriesHydrator
(
"\TicketingSystem\Ticket\GgusFields"
);
$coll
=
$hydrator
->
hydrate
(
$input
);
print_r
(
$coll
);
//
print_r($coll);
}
...
...
tests/Resources/entries.xml
View file @
da78a05f
<e:entries
xmlns:e=
"https://gitlab.in2p3.fr/opsportal/lavoisier
query
/raw/master/ex_entries.xsd"
>
<e:entries
xmlns:e=
"https://gitlab.in2p3.fr/opsportal/lavoisier
cli
/raw/master/
resources/
ex_entries.xsd"
>
<e:entry
key=
"HOSTNAME"
>
cream1.farm.particle.cz
</e:entry>
<e:entry
key=
"GOCDB_PORTAL_URL"
>
https://goc.egi.eu/portal/index.php?Page_Type=Service
&
id=751
</e:entry>
<e:entry
key=
"SERVICE_TYPE"
>
APEL
</e:entry>
...
...
tests/Resources/entries_collection.xml
View file @
da78a05f
<e:entries
xmlns:e=
"https://gitlab.in2p3.fr/opsportal/lavoisier
query
/raw/master/ex_entries.xsd"
>
<e:entries
xmlns:e=
"https://gitlab.in2p3.fr/opsportal/lavoisier
cli
/raw/master/
resources/
ex_entries.xsd"
>
<e:entries
key=
"info"
>
<e:entry
key=
"PRIMARY_KEY"
>
306G0
</e:entry>
<e:entry
key=
"CERTDN"
>
/O=GRID-FR/C=FR/O=CNRS/OU=CC-IN2P3/CN=Foo Bar
</e:entry>
...
...
tests/Resources/entries_test.xml
View file @
da78a05f
<e:entries
xmlns:e=
"http
s
://
gitlab
.in2p3.fr/
opsportal/lavoisierquery/raw/master/ex_
entries.xsd"
>
<e:entries
xmlns:e=
"http://
software
.in2p3.fr/
lavoisier/
entries.xsd"
>
<e:entries>
<e:entry
key=
"HOSTNAME"
>
cream1.farm.particle.cz
</e:entry>
<e:entry
key=
"GOCDB_PORTAL_URL"
>
https://goc.egi.eu/portal/index.php?Page_Type=Service
&
id=751
</e:entry>
...
...
tests/Resources/site_names.xml
View file @
da78a05f
<e:entries
xmlns:e=
"https://gitlab.in2p3.fr/opsportal/lavoisier
query
/raw/master/ex_entries.xsd"
>
<e:entries
xmlns:e=
"https://gitlab.in2p3.fr/opsportal/lavoisier
cli
/raw/master/
resources/
ex_entries.xsd"
>
<e:entry>
Australia-ATLAS
</e:entry>
<e:entry>
HK-HKU-CC-01
</e:entry>
<e:entry>
IN-DAE-VECC-02
</e:entry>
...
...
tests/Resources/tickets.xml
View file @
da78a05f
<e:entries
xmlns:e=
"https://gitlab.in2p3.fr/opsportal/lavoisier
query
/raw/master/ex_entries.xsd"
>
<e:entries
xmlns:e=
"https://gitlab.in2p3.fr/opsportal/lavoisier
cli
/raw/master/
resources/
ex_entries.xsd"
>
<e:entries>
<e:entry
key=
"GHD_Request_ID"
>
50455
</e:entry>
<e:entry
key=
"GHD_Modified_Date"
>
2013-11-14T08:58:41Z
</e:entry>
...
...
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