Search in sources :

Example 1 with NodeReport

use of org.alfresco.solr.NodeReport in project SearchServices by Alfresco.

the class MetadataTracker method checkNode.

public NodeReport checkNode(Node node) {
    NodeReport nodeReport = new NodeReport();
    nodeReport.setDbid(node.getId());
    nodeReport.setDbNodeStatus(node.getStatus());
    nodeReport.setDbTx(node.getTxnId());
    this.infoSrv.addCommonNodeReportInfo(nodeReport);
    return nodeReport;
}
Also used : NodeReport(org.alfresco.solr.NodeReport)

Example 2 with NodeReport

use of org.alfresco.solr.NodeReport in project SearchServices by Alfresco.

the class MetadataTrackerTest method testCheckNodeLong.

@Test
@Ignore("Superseded by AlfrescoSolrTrackerTest")
public void testCheckNodeLong() throws AuthenticationException, IOException, JSONException {
    List<Node> nodes = getNodes();
    when(repositoryClient.getNodes(any(GetNodesParameters.class), eq(1))).thenReturn(nodes);
    NodeReport nodeReport = this.metadataTracker.checkNode(DB_ID);
    assertNotNull(nodeReport);
    assertEquals(DB_ID, nodeReport.getDbid());
    assertEquals(TX_ID, nodeReport.getDbTx());
}
Also used : Node(org.alfresco.solr.client.Node) GetNodesParameters(org.alfresco.solr.client.GetNodesParameters) NodeReport(org.alfresco.solr.NodeReport) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 3 with NodeReport

use of org.alfresco.solr.NodeReport in project SearchServices by Alfresco.

the class MetadataTrackerTest method testCheckNodeNode.

@Test
@Ignore("Superseded by AlfrescoSolrTrackerTest")
public void testCheckNodeNode() {
    Node node = getNode();
    NodeReport nodeReport = this.metadataTracker.checkNode(node);
    assertNotNull(nodeReport);
    assertEquals(DB_ID, nodeReport.getDbid());
    assertEquals(TX_ID, nodeReport.getDbTx());
}
Also used : Node(org.alfresco.solr.client.Node) NodeReport(org.alfresco.solr.NodeReport) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 4 with NodeReport

use of org.alfresco.solr.NodeReport in project SearchServices by Alfresco.

the class MetadataTracker method checkNode.

public NodeReport checkNode(Long dbid) {
    NodeReport nodeReport = new NodeReport();
    nodeReport.setDbid(dbid);
    // In DB
    GetNodesParameters parameters = new GetNodesParameters();
    parameters.setFromNodeId(dbid);
    parameters.setToNodeId(dbid);
    List<Node> dbnodes;
    try {
        dbnodes = client.getNodes(parameters, 1);
        if (dbnodes.size() == 1) {
            Node dbnode = dbnodes.get(0);
            nodeReport.setDbNodeStatus(dbnode.getStatus());
            nodeReport.setDbTx(dbnode.getTxnId());
        } else {
            nodeReport.setDbNodeStatus(SolrApiNodeStatus.UNKNOWN);
            nodeReport.setDbTx(-1l);
        }
    } catch (IOException e) {
        nodeReport.setDbNodeStatus(SolrApiNodeStatus.UNKNOWN);
        nodeReport.setDbTx(-2l);
    } catch (JSONException e) {
        nodeReport.setDbNodeStatus(SolrApiNodeStatus.UNKNOWN);
        nodeReport.setDbTx(-3l);
    } catch (AuthenticationException e1) {
        nodeReport.setDbNodeStatus(SolrApiNodeStatus.UNKNOWN);
        nodeReport.setDbTx(-4l);
    }
    this.infoSrv.addCommonNodeReportInfo(nodeReport);
    return nodeReport;
}
Also used : AuthenticationException(org.alfresco.httpclient.AuthenticationException) GetNodesParameters(org.alfresco.solr.client.GetNodesParameters) Node(org.alfresco.solr.client.Node) JSONException(org.json.JSONException) IOException(java.io.IOException) NodeReport(org.alfresco.solr.NodeReport)

Aggregations

NodeReport (org.alfresco.solr.NodeReport)4 Node (org.alfresco.solr.client.Node)3 GetNodesParameters (org.alfresco.solr.client.GetNodesParameters)2 Ignore (org.junit.Ignore)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 AuthenticationException (org.alfresco.httpclient.AuthenticationException)1 JSONException (org.json.JSONException)1