diff --git a/LogTable.stories.js b/LogTable.stories.js new file mode 100644 index 000000000..549d95cf3 --- /dev/null +++ b/LogTable.stories.js @@ -0,0 +1,101 @@ +import { storiesOf } from '@storybook/react'; +import React from 'react'; +import 'antd/dist/antd.css'; +import { Input, Table, Icon, Layout, } from 'antd'; + +class Sider extends React.Component { + handleClick = (e) => { + console.log('click ', e); + }; +} + +class LogTable extends React.Component { + constructor() { + super(); + this.state = { + formLayout: 'horizontal', + }; + } + + handleFormLayoutChange = (e) => { + this.setState({ formLayout: e.target.value }); + }; + + render() { + + const { Content } = Layout; + + + const columns = [ + { + title: 'TYPE', + dataIndex: 'type', + key: 'type', + width: 80, + }, + { + title: 'TIMESTAMP', + dataIndex: 'timestamp', + key: 'timestamp', + width: 250, + }, + { + title: 'DPU INSTANSE', + key: 'dpu', + dataIndex: 'dpu', + width: 210, + }, + { + title: 'MESSAGE', + dataIndex: 'message', + key: 'message', + }, + ]; + + + const data = [ + { + key: '1', + type: , + timestamp: , + dpu: , + message: , + }, + { + key: '2', + type: , + timestamp: 'Aug 4, 2019 12:00:00', + dpu: 'SPARQL EXTRACTOR', + message: 'Message ', + }, + ]; + + return ( +
+ + + + + + + ); + } +} + +storiesOf('Log', module).add('Table', () => ); diff --git a/src/rdf4j-tests/delete.test.js b/src/rdf4j-tests/delete.test.js new file mode 100644 index 000000000..90acfb458 --- /dev/null +++ b/src/rdf4j-tests/delete.test.js @@ -0,0 +1,78 @@ +jest.setTimeout(50000); +var location = ''; +var urlDir = 'https://agentlab.ru/rdf4j-server/repositories/sdf'; +const data = ' . ' + + 'GRAPH {' + + ' 111} '; + +test('Add transaction', async () => { + const url = 'https://agentlab.ru/rdf4j-server/repositories/sdf/transactions'; + var result = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + Accept: 'application/sparql-results+json', + }, + body: url, + }).then((r) => { + console.log(r); + expect(r).toBeInstanceOf(Response); + expect(r['status']).toEqual(201); + var loc = r.headers.get('location'); + location = loc; + return r; + }); +}); + + +test('Add data', async () => { + //добавление + const urlprefix = location + '?action=UPDATE'; + console.log(urlprefix); + var result = await fetch(urlprefix, { + method: 'PUT', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + //Accept: 'application/sparql-results+json', + }, + body: 'update=' + encodeURIComponent('INSERT DATA' + '{' + data + '}'), + }).then((r) => { + console.log(r); + expect(r).toBeInstanceOf(Response); + expect(r['status']).toEqual(200); + return r; + }); +}); + +test('Delete data', async () => { + const urlprefix = location + '?action=UPDATE'; + var result = await fetch(urlprefix, { + method: 'PUT', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + //Accept: 'application/sparql-results+json', + }, + body: 'update=' + encodeURIComponent('DELETE DATA' + '{' + data + '}'), + }).then((r) => { + console.log(r); + expect(r).toBeInstanceOf(Response); + expect(r['status']).toEqual(200); + return r; + }); +}); + +test('Delete transaction', async () => { + var result = await fetch(location, { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + Accept: 'application/sparql-results+json', + }, + body: encodeURIComponent('DELETE' + '{' + location + '}'), + }).then((r) => { + console.log(r); + expect(r).toBeInstanceOf(Response); + expect(r['status']).toEqual(204); + return r; + }); +});