Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #151 from sbalabanov/master
Browse files Browse the repository at this point in the history
Nailgun 1.0.0
  • Loading branch information
ttsugriy authored Oct 13, 2018
2 parents b5d78e1 + 2756455 commit 19e0d9a
Show file tree
Hide file tree
Showing 63 changed files with 569 additions and 436 deletions.
1 change: 1 addition & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Nailgun Copyright © 2004-2012, Martian Software, Inc.
Copyright © 2017-present Facebook, Inc.

Apache License
Version 2.0, January 2004
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ you will additionally need to "make ng.exe".

A ruby client is available through the [railgun](https://github.com/timuralp/railgun) project.

For more information, see [the nailgun website](http://martiansoftware.com/nailgun/).
For more information, see [the nailgun website](https://github.com/facebook/nailgun).


5 changes: 2 additions & 3 deletions nailgun-client/c/ng.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright 2004-2012, Martian Software, Inc.
Copyright 2017-Present Facebook, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -13,7 +13,6 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

/**
Expand Down Expand Up @@ -42,7 +41,7 @@
#include <fcntl.h>
#include <errno.h>

#define NAILGUN_VERSION "0.9.0"
#define NAILGUN_VERSION "1.0.0"

#define BUFSIZE (2048)

Expand Down
3 changes: 2 additions & 1 deletion nailgun-client/py/ng.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
#
# Copyright 2004-2015, Martian Software, Inc.
# Copyright 2017-Present Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,7 +56,7 @@ def bytes_to_str(bytes_to_convert):
#
# Please try to keep this working on Python 2.6.

NAILGUN_VERSION = "0.9.3"
NAILGUN_VERSION = "1.0.0"
BUFSIZE = 2048
NAILGUN_PORT_DEFAULT = 2113
CHUNK_HEADER_LEN = 5
Expand Down
37 changes: 27 additions & 10 deletions nailgun-client/py/test_ng.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
#!/usr/bin/env python
#
# Copyright 2004-2015, Martian Software, Inc.
# Copyright 2017-Present Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import subprocess
import os
import time
Expand Down Expand Up @@ -60,8 +77,8 @@ def setUpTransport(self):

def getClassPath(self):
cp = [
"nailgun-server/target/nailgun-server-0.9.3-SNAPSHOT-uber.jar",
"nailgun-examples/target/nailgun-examples-0.9.3-SNAPSHOT.jar",
"nailgun-server/target/nailgun-server-1.0.0-SNAPSHOT-uber.jar",
"nailgun-examples/target/nailgun-examples-1.0.0-SNAPSHOT.jar",
]
if os.name == "nt":
return ";".join(cp)
Expand Down Expand Up @@ -119,7 +136,7 @@ def preexec_fn():
+ suspend
)
cmd = cmd + [
"com.martiansoftware.nailgun.NGServer",
"com.facebook.nailgun.NGServer",
self.transport_address,
str(self.heartbeat_timeout_ms),
]
Expand Down Expand Up @@ -196,7 +213,7 @@ def test_nailgun_stats(self):
exit_code = c.send_command("ng-stats")
self.assertEqual(exit_code, 0)
actual_out = output.getvalue().strip()
expected_out = "com.martiansoftware.nailgun.builtins.NGServerStats: 1/1"
expected_out = "com.facebook.nailgun.builtins.NGServerStats: 1/1"
self.assertEqual(actual_out, expected_out)

def test_nailgun_exit_code(self):
Expand All @@ -206,7 +223,7 @@ def test_nailgun_exit_code(self):
self.transport_address, stderr=None, stdin=None, stdout=output
) as c:
exit_code = c.send_command(
"com.martiansoftware.nailgun.examples.Exit", [str(expected_exit_code)]
"com.facebook.nailgun.examples.Exit", [str(expected_exit_code)]
)
self.assertEqual(exit_code, expected_exit_code)

Expand All @@ -218,7 +235,7 @@ def test_nailgun_stdin(self):
with NailgunConnection(
self.transport_address, stderr=None, stdin=input, stdout=output
) as c:
exit_code = c.send_command("com.martiansoftware.nailgun.examples.Echo")
exit_code = c.send_command("com.facebook.nailgun.examples.Echo")
self.assertEqual(exit_code, 0)
actual_out = output.getvalue().strip()
self.assertEqual(actual_out, echo)
Expand All @@ -240,7 +257,7 @@ def test_nailgun_heartbeats(self):
# just run Heartbeat nail for 5 seconds. During this period there should be
# heartbeats received and printed back
exit_code = c.send_command(
"com.martiansoftware.nailgun.examples.Heartbeat", ["5000"]
"com.facebook.nailgun.examples.Heartbeat", ["5000"]
)
self.assertTrue(output.getvalue().count("H") > 10)

Expand All @@ -254,7 +271,7 @@ def test_nailgun_no_heartbeat(self):
heartbeat_interval_sec=0,
) as c:
exit_code = c.send_command(
"com.martiansoftware.nailgun.examples.Heartbeat", ["3000"]
"com.facebook.nailgun.examples.Heartbeat", ["3000"]
)
self.assertTrue(output.getvalue().count("H") == 0)

Expand All @@ -269,7 +286,7 @@ def test_stress_nailgun_socket_close_without_race_condition(self):
heartbeat_interval_sec=0.001,
) as c:
exit_code = c.send_command(
"com.martiansoftware.nailgun.examples.Heartbeat", ["10"]
"com.facebook.nailgun.examples.Heartbeat", ["10"]
)
self.assertEqual(exit_code, 0)

Expand Down Expand Up @@ -301,7 +318,7 @@ def test_nailgun_disconnect(self):
heartbeat_interval_sec=5,
) as c:
exit_code = c.send_command(
"com.martiansoftware.nailgun.examples.Heartbeat", ["30000"]
"com.facebook.nailgun.examples.Heartbeat", ["30000"]
)
self.assertTrue(output.getvalue().count("H") < 3)

Expand Down
8 changes: 4 additions & 4 deletions nailgun-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.martiansoftware</groupId>
<groupId>com.facebook</groupId>
<artifactId>nailgun-examples</artifactId>
<packaging>jar</packaging>

Expand All @@ -19,14 +19,14 @@
<url>http://github.com/facebook/nailgun</url>

<parent>
<groupId>com.martiansoftware</groupId>
<groupId>com.facebook</groupId>
<artifactId>nailgun-all</artifactId>
<version>0.9.3-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
</parent>

<dependencies>
<dependency>
<groupId>com.martiansoftware</groupId>
<groupId>com.facebook</groupId>
<artifactId>nailgun-server</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright 2004-2012, Martian Software, Inc.
Copyright 2017-Present Facebook, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -13,12 +13,11 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package com.martiansoftware.nailgun.examples;
package com.facebook.nailgun.examples;

import com.martiansoftware.nailgun.NGContext;
import com.facebook.nailgun.NGContext;
import java.util.TreeSet;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright 2004-2012, Martian Software, Inc.
Copyright 2017-Present Facebook, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -13,10 +13,9 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package com.martiansoftware.nailgun.examples;
package com.facebook.nailgun.examples;

/**
* Echos everything it reads from System.in to System.out.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
Copyright 2004-2012, Martian Software, Inc.
Copyright 2017-Present Facebook, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package com.facebook.nailgun.examples;

/** Finish nail with provided exit code */
public class Exit {

public static void main(String[] args) {
int exitCode = (int) ((Math.random() * 1000) + 1);
if (args.length > 0) {
try {
exitCode = Integer.parseInt(args[0]);
} catch (Exception e) {
}
}
// Close stdout to test the exit code is returned properly
// even in such case
System.out.close();
System.exit(exitCode);
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
/*
Copyright 2004-2012, Martian Software, Inc.
Copyright 2017-Present Facebook, Inc.
Copyright 2004-2012, Martian Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package com.martiansoftware.nailgun.examples;
package com.facebook.nailgun.examples;

import com.martiansoftware.nailgun.NGContext;
import com.facebook.nailgun.NGContext;
import java.security.MessageDigest;
import java.security.Provider;
import java.security.Security;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
Copyright 2004-2012, Jim Purbrick.
Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -13,12 +12,11 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package com.martiansoftware.nailgun.examples;
package com.facebook.nailgun.examples;

import com.martiansoftware.nailgun.NGContext;
import com.facebook.nailgun.NGContext;
import java.util.concurrent.atomic.AtomicBoolean;

/** Print H for each heartbeat received */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright 2004-2012, Martian Software, Inc.
Copyright 2017-Present Facebook, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -13,10 +13,9 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package com.martiansoftware.nailgun.examples;
package com.facebook.nailgun.examples;

/**
* A truly amazing program that must be seen to be believed.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright 2004-2012, Martian Software, Inc.
Copyright 2017-Present Facebook, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -13,12 +13,11 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package com.martiansoftware.nailgun.examples;
package com.facebook.nailgun.examples;

import com.martiansoftware.nailgun.NGContext;
import com.facebook.nailgun.NGContext;

/**
* Prompts the user for input using a JOptionPane, and displays the result to the client's stdout.
Expand Down
Loading

0 comments on commit 19e0d9a

Please sign in to comment.