Le 2014-03-25 14:16, Marc-André Laperle
a écrit :
Hi Francis,
Can you push this patch to Gerrit? Here's a page with information about
Gerrit:
https://wiki.eclipse.org/Gerrit
I tried this before sending the patch on the ML. My commit is
rejected by gerrit.
* The URL to push is
ssh://fgiraldeauodl@xxxxxxxxxxxxxxx:29418/linuxtools/org.eclipse.linuxtools.git
* My SSH key is uploaded and login test is working
* I signed the CLA
* I waited for the 1h delay that may affect signature verification
* I verified that the commit has change-id and signed-off-by
* The author info matches the CLA and my eclipse forge info
In the
Contributor License Agreement Lookup Tool, there is a valid CLA on
file for francis.giraldeau@xxxxxxxxx.
Here is the message:
[francis@blob org.eclipse.linuxtools]$ git push review
Counting objects: 56, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (17/17), done.
Writing objects: 100% (30/30), 7.10 KiB | 0 bytes/s, done.
Total 30 (delta 12), reused 0 (delta 0)
remote: Resolving deltas: 100% (12/12)
remote: Processing changes: refs: 1, done
remote: ----------
remote: Reviewing commit: commit
39704b4b48ed40b07a9b8a3929cc550c8aef42f7 1395770199 ----sp
remote: Authored by: Francis Giraldeau
<francis.giraldeau@xxxxxxxxx>
remote:
remote: The author is not a committer on the project.
remote: error: The author does not have a current Contributor
License Agreement (CLA) on file.
remote:
remote: The author has "signed-off" on the contribution.
remote: Please see http://wiki.eclipse.org/CLA
To
ssh://fgiraldeauodl@xxxxxxxxxxxxxxx:29418/linuxtools/org.eclipse.linuxtools.git
! [remote rejected] HEAD -> refs/for/master (A Contributor
License Agreement is required.)
What else can I do?
Francis
Marc-André
On 14-03-25 01:59 PM, Francis Giraldeau wrote:
It is possible to get the children of an attribute. This patch add also
required methods to query the parent attributes.
* Add getParent() method to Attribute, AttributeTree and StateSystem
* Add unit test to check the functionality
* Provides the required documentation
Change-Id: I635326068c2a298b32952599e09b2426b2e1fbb0
Signed-off-by: Francis Giraldeau <francis.giraldeau@xxxxxxxxx>
---
.../core/tests/stateprovider/StateSystemTest.java | 19 +++++++++++++++++++
.../internal/tmf/core/statesystem/Attribute.java | 16 ++++++++++++++++
.../internal/tmf/core/statesystem/AttributeTree.java | 11 +++++++++++
.../internal/tmf/core/statesystem/StateSystem.java | 5 +++++
.../tmf/core/statesystem/ITmfStateSystem.java | 9 +++++++++
5 files changed, 60 insertions(+)
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemTest.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemTest.java
index 2f46cc3..7370c1a 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemTest.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemTest.java
@@ -422,4 +422,23 @@ public abstract class StateSystemTest {
fail();
}
}
+
+ @Test
+ public void testParentAttribute() {
+ String[] path = { "CPUs/0/Current_thread",
+ "CPUs/0",
+ "CPUs" };
+ try {
+ int q = ssq.getQuarkAbsolute(Attributes.CPUS, "0", Attributes.CURRENT_THREAD);
+ for (int i = 0; i < path.length; i++) {
+ String name = ssq.getFullAttributePath(q);
+ assertEquals(path[i], name);
+ q = ssq.getParentAttributeQuark(q);
+ }
+ assertEquals(-1, q);
+ } catch (AttributeNotFoundException e) {
+ fail();
+ }
+ }
+
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/Attribute.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/Attribute.java
index 4cd830d..a238a0c 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/Attribute.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/Attribute.java
@@ -129,6 +129,22 @@ public abstract class Attribute {
return targetNode.getQuark();
}
+ /**
+ * Get the parent attribute of this attribute
+ * @return The parent attribute
+ */
+ public Attribute getParentAttribute() {
+ return this.parent;
+ }
+
+ /**
+ * Get the parent quark of this attribute
+ * @return The quark of the parent attribute
+ */
+ public int getParentAttributeQuark() {
+ return this.parent.getQuark();
+ }
+
/* The methods how to access children are left to derived classes */
/**
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/AttributeTree.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/AttributeTree.java
index 3d897c6..49d6dcc 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/AttributeTree.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/AttributeTree.java
@@ -357,6 +357,17 @@ public final class AttributeTree {
return listOfChildren;
}
+ /**
+ * Returns the parent quark of the attribute. The root attribute
+ * has no parent.
+ *
+ * @param attributeQuark The quark of the attribute
+ * @return Quark of the parent attribute
+ */
+ public int getParentAttributeQuark(int quark) {
+ return attributeList.get(quark).getParentAttributeQuark();
+ }
+
private void addSubAttributes(List<Integer> list, Attribute curAttribute,
boolean recursive) {
for (Attribute childNode : curAttribute.getSubAttributes()) {
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/StateSystem.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/StateSystem.java
index 981467f..00871e8 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/StateSystem.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/StateSystem.java
@@ -278,6 +278,11 @@ public class StateSystem implements ITmfStateSystemBuilder {
}
@Override
+ public int getParentAttributeQuark(int quark) {
+ return getAttributeTree().getParentAttributeQuark(quark);
+ }
+
+ @Override
public List<Integer> getQuarks(String... pattern) {
List<Integer> quarks = new LinkedList<>();
List<String> prefix = new LinkedList<>();
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/ITmfStateSystem.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/ITmfStateSystem.java
index 4682c15..3d24b7a 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/ITmfStateSystem.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/ITmfStateSystem.java
@@ -249,6 +249,15 @@ public interface ITmfStateSystem {
String getFullAttributePath(int attributeQuark);
/**
+ * Returns the parent quark of the attribute. The root attribute
+ * has no parent.
+ *
+ * @param attributeQuark The quark of the attribute
+ * @return Quark of the parent attribute
+ */
+ int getParentAttributeQuark(int attributeQuark);
+
+ /**
* @name Query methods
*/
_______________________________________________
linuxtools-dev mailing list
linuxtools-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/linuxtools-dev
|