Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lab 2 Issue #85 #169

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions LogTable.stories.js
Original file line number Diff line number Diff line change
@@ -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: <select name="" style={{ width: '100%' }} >
<option value="all">ALL</option>
<option value="error">ERROR+</option>
<option value="warn">WARN+</option>
<option value="info">INFO+</option>
<option value="debug">DEBUG+</option>
<option value="trace">TRACE+</option>
</select>,
timestamp: <select name="" style={{ width: '100%' }} >
<option value="all"></option>
</select>,
dpu: <select name="" style={{ width: '100%' }}>
<option value="all"></option>
</select>,
message: <Input style={{ width: '100%' }} />,
},
{
key: '2',
type: <Icon type="close-circle" theme="twoTone" twoToneColor="#eb2f96" />,
timestamp: 'Aug 4, 2019 12:00:00',
dpu: 'SPARQL EXTRACTOR',
message: 'Message ',
},
];

return (
<div>
<Layout>
<Content style={{ background: '#fff' }}>
<Table
size='middle'
columns={columns}
dataSource={data}
bordered
/>
</Content>
</Layout>
</div>
);
}
}

storiesOf('Log', module).add('Table', () => <LogTable />);
78 changes: 78 additions & 0 deletions src/rdf4j-tests/delete.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
jest.setTimeout(50000);
var location = '';
var urlDir = 'https://agentlab.ru/rdf4j-server/repositories/sdf';
const data = '<http://exampleSub> <http://examplePred> <http://exampleObj>. ' +
'GRAPH <urn:sparql:tests:insert:data> {' +
'<http://exampleSub> <http://examplePred> 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;
});
});